Skip to content

fix(orchestration): count a requeued job's previous walltime and retry once - #4978

Open
wprazuch wants to merge 1 commit into
mainfrom
wprazuch/resume-requeue-idempotent
Open

wprazuch wants to merge 1 commit into
mainfrom
wprazuch/resume-requeue-idempotent

Conversation

@wprazuch

@wprazuch wprazuch commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

When Slurm requeues a job (node failure, preemption), it keeps the job id and runs job.sh again with the same previous-job argument. The auto-resume prologue then adds the previous job's walltime to .gym_accumulated_walltime a second time, and spends a second infra retry for the same failure. With max_walltime set, a chain can stop hours before its real budget is used.

The prologue now counts each previous job once. It takes an atomic mkdir marker (.gym_prev_job_counted.<prev_job_id>) in the output dir. Only the run that creates the marker adds the walltime and the retry.

No linked issue: found while debugging a chain that stopped early on a requeued job. This complements #4840 (merged), which stops a requeue from queueing a duplicate follow-up job. The two touch the same prologue but fix different counters.

Validation

  • uv run --extra dev python -m pytest tests/unit_tests/test_resume_script.py tests/unit_tests/test_eval_resubmit.py tests/unit_tests/test_slurm_script.py tests/unit_tests/test_slurm_executor.py: 365 passed, on top of fix(orchestration): uv on PATH, one resume follow-up per job, resubmit round trip, failed chain stops #4840.
  • Two new tests run the real prologue twice with the same previous job id. Both fail before the fix and pass after.
  • test_max_retries_allows_exactly_that_many_retries now uses a distinct previous job id per retry, as real chains do.
  • Full unit suite: the same 2 failures with and without this change (local macOS environment).
  • pre-commit run --all-files: passed.

Rollouts

N/A. This changes Slurm orchestration only. No environment or agent code changes.

Compatibility and benchmark impact

None. Chains that are never requeued behave exactly as before.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification. N/A: internal prologue behavior, no user-facing option changed.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header. N/A: no new files.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@github-actions

Copy link
Copy Markdown
Contributor

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:orchestration Job submission, deployment, services, and lifecycle management bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer labels Oct 23, 2026
…y once

A Slurm requeue keeps the job id and runs job.sh again with the same previous
job, so the auto-resume prologue added that job's walltime (and an infra retry)
a second time. The walltime cap could then stop a chain hours early.

Signed-off-by: Wojciech Prazuch <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 9c749fc9 Deployed Oct 23, 2026 by copy-pr-bot[bot] via release / finalize / notify #6826
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:orchestration Job submission, deployment, services, and lifecycle management bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer sla:triage-overdue Review assignment is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants