Skip to content

fix(slurm): tear down inference-only nodes after clean trainer exit#2961

Draft
eligotts wants to merge 1 commit into
mainfrom
fix/slurm-inference-teardown
Draft

fix(slurm): tear down inference-only nodes after clean trainer exit#2961
eligotts wants to merge 1 commit into
mainfrom
fix/slurm-inference-teardown

Conversation

@eligotts

@eligotts eligotts commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

srun --kill-on-bad-exit=1 only reaps peer tasks on non-zero exits, so in separate train/inference multi-node RL a trainer that finished cleanly left the inference-only nodes running vLLM until the allocation hit its time limit — the job stayed RUNNING with idle GPUs after RL trainer finished!.

This adds a run-completion sentinel ($OUTPUT_DIR/control/slurm_run_complete) for deployments with inference-only nodes:

  • The trainer task wrapper touches the sentinel on exit 0 and propagates its exit code either way, so failure teardown via --kill-on-bad-exit is unchanged.
  • Inference-only nodes run a watcher that exits cleanly once the sentinel appears; an inference component exiting without the sentinel is forced to exit 1 so premature vLLM/router death still tears the job down.
  • The orchestrator-hosting task re-waits when the orchestrator exits cleanly before the trainer finishes — otherwise its wait -n would return early and kill the trainer wrapper before it could touch the sentinel.

Single-group deployments (num_infer_nodes == 0) render without any of this.

Validation

  • Rendered the template with num_infer_nodes 0 and 2; sentinel machinery present only in the latter; bash -n passes on both rendered scripts.
  • Pending: a live SLURM smoke in both directions — clean trainer exit tears down inference nodes, and trainer failure still propagates non-zero. Keeping as draft until that runs.

🤖 Generated with Claude Code

`srun --kill-on-bad-exit=1` only reaps peer tasks on non-zero exits, so a
trainer that finishes cleanly left inference-only nodes running vLLM until
the allocation hit its time limit.

Add a run-completion sentinel for separate train/inference deployments:

- The trainer task wrapper touches `$OUTPUT_DIR/control/slurm_run_complete`
  on exit 0 (and propagates its exit code either way).
- Inference-only nodes run a watcher that exits cleanly once the sentinel
  appears; an inference component exiting *without* the sentinel is treated
  as a failure so kill-on-bad-exit still tears the job down.
- The orchestrator-hosting task re-waits when the orchestrator exits cleanly
  before the trainer finishes — otherwise its `wait -n` would return early
  and kill the trainer wrapper before it touches the sentinel.

Validated by rendering the template with and without inference nodes and
`bash -n` on both outputs; a live two-direction SLURM smoke (clean exit
teardown, failure propagation) is still pending.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant