Chansoo/ensemble jobhandler event wait - #2580
Merged
wangcj05 merged 4 commits intoJul 14, 2026
Merged
Conversation
added 2 commits
May 19, 2026 17:12
(cherry picked from commit f81a343)
wangcj05
requested changes
Jun 4, 2026
wangcj05
left a comment
Collaborator
There was a problem hiding this comment.
@chansoolee I have few comments for you to consider.
Collaborator
|
tests are good also. |
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.
Pull Request Description
What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)
#2567
What are the significant changes in functionality due to this change request?
This change stabilizes EnsembleModel job completion when using the threaded parallel strategy. Previously, each ensemble evaluation thread repeatedly polled
JobHandler.isThisJobFinished(), which acquired the shared JobHandler queue lock. With many concurrent ensemble evaluations, this polling could create enough lock contention to prevent the JobHandler polling loop from promptly moving completed jobs into the finished queue, producing hangs even after subprocesses had completed.The JobHandler now creates a per-job
threading.Eventwhen a job is submitted, sets that event when the job is moved to the finished queue, and exposesgetJobEvent()so EnsembleModel can wait on job completion without repeatedly acquiring the queue lock. The previous polling path remains as a fallback if no event is available.This PR also improves failed sub-model handling in EnsembleModel. Failed evaluations now return no evaluation and allow the existing failed-run handling path to process the failure, instead of raising immediately and potentially leaving nested ensemble jobs unclaimed. Cleanup is limited to models that were actually submitted before the failed model, avoiding waits on downstream models that were never launched.
Additionally,
MessageHandler.printWarnings()now clears stored warnings after printing so warnings are not reprinted later by subsequent error handling. A focused JobHandler unit test was added to verify event creation, event signaling on completion, and event cleanup after finished-job collection.Tests performed
The following checks were run in
/home/leec3/projects/raven_idaholab_issue2567:python -m py_compile ravenframework/JobHandler.py ravenframework/MessageHandler.py ravenframework/Models/EnsembleModel.py tests/framework/unit_tests/JobHandler/testJobHandlerEvents.pypython -m py_compile ravenframework/CustomModes/PBSSimulationMode.py ravenframework/CustomModes/MPILegacySimulationMode.py./run_tests --test-dir tests/framework/unit_tests/JobHandler./run_tests --test-dir tests/framework/ensembleModelTests --re 'testEnsembleModelLinearThread|testEnsembleModelLinearExpectedFailure|testEnsembleModelWithCode' -j 3git diff --checkCluster/qsub validation was also run through Slurm:
1873408./run_tests --raven --test-dir tests/cluster_tests/InternalParallel --re 'test_parallel_ensemble_linear' --run-types qsub -j 1COMPLETED, exit code0:0PASSED: 1,FAILED: 0Tested sets: RAVEN PluginAPI,... tests passed!For Change Control Board: Change Request Review
The following review must be completed by an authorized member of the Change Control Board.
<internalParallel>to True.raven/tests/framework/user_guideandraven/docs/workshop) have been changed, the associated documentation must be reviewed and assured the text matches the example.