fix(run): validate job options before generating job script#1513
Closed
lb1192176991-lab wants to merge 1 commit into
Closed
fix(run): validate job options before generating job script#1513lb1192176991-lab wants to merge 1 commit into
lb1192176991-lab wants to merge 1 commit into
Conversation
__generate_job_script() was called before __validate_job_options(), so an invalid invocation (e.g. --no-mpi with >1 rank, nodes <= 0, or a malformed --email) would write a stale .sh to disk and only then fail. Swap the call order so validation runs first. Fixes part (b) of MFlowCode#1511.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1513 +/- ##
=======================================
Coverage 60.64% 60.64%
=======================================
Files 73 73
Lines 20213 20213
Branches 2936 2936
=======================================
Hits 12259 12259
Misses 5966 5966
Partials 1988 1988 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
What
Moves
__validate_job_options()before__generate_job_script()inrun()so that invalid invocations (e.g.--no-mpiwith >1 rank,nodes <= 0, malformed--email) are rejected before a stale.shfile is written to disk.Why
Previously the call order was:
__generate_job_script(...)— writes the job.shto disk__validate_job_options()— may raiseMFCExceptionAn invalid invocation would leave a confusing stale job script on disk while aborting the run.
Testing
This is a pure reorder of two function calls —
__validate_job_options()has no side effects (it readsARG()and may raise). Existing callers ofrun()exercise both paths.Fixes part (b) of #1511.