test(preopt): skip GFN-FF tests when libxtb can't load under parallel load - #56
Merged
Merged
Conversation
Under `pytest -n auto`, conda's libxtb shared library intermittently fails its first dlopen in a worker and raises "xtb C extension unimportable, cannot use C-API" at run time, turning two GFN-FF relaxation tests into flaky failures. It reproduces only under heavy local parallel load — CI's pip-wheel xtb is unaffected, and the app itself degrades to an honest no-op, so this is test noise, not a bug. Gate `xtb_only` on `_gfnff_runnable()`: one real minimal GFN-FF run, cached per worker process. If libxtb won't load, the tests skip cleanly with an honest reason; if it does load, the extension is primed so the run-time flake can't recur for the rest of that worker's tests. A genuine GFN-FF regression still surfaces (extension loads, tests run, assertions fail). preopt.py is unchanged. Note: the earlier "broken C-API" read was a misdiagnosis — `import xtb.libxtb` and a real GFN-FF run both succeed here; the actual cause is parallel-load dlopen contention. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes flaky local failures of the GFN-FF (xtb) pre-optimization tests under
pytest -n auto. Test-only change —preopt.pyis untouched, and CI is unaffected.Under heavy parallel load (~18 xdist workers), conda's
libxtbshared library intermittently fails its firstdlopenin whichever worker runs the GFN-FF relaxation tests, raisingxtb C extension unimportable, cannot use C-APIat run time. This turnedtest_relaxes_distorted_metalandtest_trajectory_multiframe_ends_at_kept_geometryinto flaky failures in the full suite only — they pass when the file is run alone, CI's pip-wheel xtb is unaffected, and the app itself already degrades to an honest no-op. So this is local test noise, not a product bug.xtb_onlynow gates on_gfnff_runnable()— one real minimal GFN-FF run, cached per worker process:libxtbwon't load, the GFN-FF tests skip cleanly with an honest reason instead of failing.This also supersedes an earlier "broken C-API" hypothesis, which was a misread —
import xtb.libxtband a real GFN-FF run both succeed here; the cause is dlopen contention under parallel load, not a broken extension.Test plan
tests/test_preopt_gfnff.pyalone — all pass.pytest -m "not network"under-n auto— 2573 passed, 29 skipped, 0 failed (previously 2 hard failures; the GFN-FF tests now skip cleanly in a worker where libxtb won't load).