Skip to content

fix(run): validate job options before generating job script#1513

Closed
lb1192176991-lab wants to merge 1 commit into
MFlowCode:masterfrom
lb1192176991-lab:fix/run-validate-before-generate
Closed

fix(run): validate job options before generating job script#1513
lb1192176991-lab wants to merge 1 commit into
MFlowCode:masterfrom
lb1192176991-lab:fix/run-validate-before-generate

Conversation

@lb1192176991-lab
Copy link
Copy Markdown

What

Moves __validate_job_options() before __generate_job_script() in run() so that invalid invocations (e.g. --no-mpi with >1 rank, nodes <= 0, malformed --email) are rejected before a stale .sh file is written to disk.

Why

Previously the call order was:

  1. __generate_job_script(...) — writes the job .sh to disk
  2. __validate_job_options() — may raise MFCException

An 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 reads ARG() and may raise). Existing callers of run() exercise both paths.

Fixes part (b) of #1511.

__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
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.64%. Comparing base (08d12f8) to head (f576652).
⚠️ Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants