Parallelize the screen driver over molecules - #97
Merged
Merged
Conversation
Add a jobs parameter (and -j/--jobs CLI flag; default 1 = serial). With jobs > 1 the molecules run in a ProcessPoolExecutor over a module-level, picklable worker (_run_job) -- process-based because each job changes the working directory via os.chdir, so threads would race. Per-job error isolation, resume (skip completed), atomic incremental writes, and deterministic input-order output are all preserved. Tests use a synchronous fake executor to exercise the parallel branch without real subprocesses. Closes #96
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #97 +/- ##
==========================================
+ Coverage 96.96% 97.02% +0.06%
==========================================
Files 28 28
Lines 1714 1749 +35
==========================================
+ Hits 1662 1697 +35
Misses 52 52
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Address review of the parallel screen: - Reject duplicate molecule names in _load_jobs (names key both the result record and the per-molecule directory, so a collision would drop a result and race two parallel jobs into the same directory). - Convert a dead worker process (BrokenProcessPool / OOM) into a per-job error record instead of aborting the whole screen. - Cap the pool at min(jobs, len(pending)). Add tests for duplicate-name rejection, worker-partial picklability (which the in-process fake executor can't catch), reversed completion order, and worker-death survival.
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.
screenran molecules serially; each job already runs in its own isolated directory, so the loop is embarrassingly parallel.jobsparameter onscreenand-j/--jobsCLI flag (default 1 = serial, unchanged behaviour).jobs > 1, molecules run in aProcessPoolExecutorover a module-level, picklable worker (_run_job). Process-based because_run_thermochanges the working directory viaos.chdir(api.py:503), so threads would race on the process-global cwd.The parallel branch is tested with a synchronous fake executor (so monkeypatched engines apply and no real subprocess/binary is needed): order preservation, failure isolation, and a
jobs < 1guard. Full patch coverage.Closes #96