Add ntasks to SlurmExecutor (#381) #589
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 340 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.349
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #589"
general
weight: 0.35
CodersAcademy006
Closes #381.
Why this was awkward before
SlurmExecutor.SBATCH_FLAGSalready contains"ntasks", andSlurmBatchRequestbuilds its sbatch parameters asasdict(executor)filtered through that list. So the flag was reachable in principle but the field never existed, which leftadditional_parameters={"ntasks": 8}as the only route, and that still emitted--ntasks-per-node=1alongside it from the field default. @activatedgeek's point in the issue is exactly that: the user ends up hand-deriving a per-node topology for what Slurm can size directly.Change
ntasks: Optional[int] = None. Being inSBATCH_FLAGSalready, it renders as#SBATCH --ntasks=<n>with no plumbing.ntasksis set,ntasks_per_nodeis dropped from the emitted flags. Slurm treats--ntasks-per-nodeas a per-node maximum when--ntasksis also present, so leaving the default of 1 in place would cap an explicit--ntasks=8at one task per node. The same exclusion is applied in the interactivesrun()helper, sinceSRUN_ARGSlists both names and would otherwise drift from the sbatch path.ntaskswithheterogeneous=Trueis rejected in__post_init__. Het groups get their sizes fromresource_groupentries, which carry their ownntasks_per_node, so a top-level total would be silently overridden. A clear assertion beats that.Default behaviour is unchanged: with
ntasksunset, the script still renders#SBATCH --ntasks-per-node=1and no--ntasks.Tests
Four in
test/core/execution/test_slurm_templates.py:test_dummy_batch_request_ntasksmaterializes withntasks=8and asserts--ntasks=8is present and--ntasks-per-nodeis gone.test_dummy_batch_request_ntasks_per_node_defaultpins the unchanged default path.test_srun_ntasks_drops_ntasks_per_nodeasserts the interactivesruncommand agrees with sbatch, so the two copies of the rule cannot diverge.test_ntasks_rejected_for_heterogeneouscovers the assertion.Verified locally: 42 passed in that file, 142 passed across
test_slurm.py,test_slurm_templates.py,test_slurm_job_name.pyandtest/run/test_experiment.py. Reverting only thenemo_run/half fails 3 of the 4 new tests.ruff format --diffandruff checkclean. No Slurm cluster here, so the verification is at the rendered-script level, and the flag semantics are per the sbatch and srun man pages rather than measured.@ko3n1g one design question worth your call: I made
ntaskswin overntasks_per_nodebecause the latter is a field default rather than an explicit choice. If you would rather haventasks_per_nodewin, or have both emitted and let Slurm reject the combination, say which and I will switch it.