Repository navigation
feat(orchestration): add gym eval resubmit for in-place Slurm resubmits - #4766
Conversation
Resubmitting a failed Slurm run in place meant running sbatch on its job.sh by hand and keeping the job chain up to date. `gym eval resubmit JOB_DIR` queues the benchmark's own job.sh again from its job dir, so the same config resumes into the same run, and prints the new job id. It refuses while one of the caller's jobs still runs in that job dir, so two jobs never write one run. A resubmit gives every failed rollout that is not final a fresh attempt budget. It records the failures sidecar's line count in <stem>_resubmit_offset next to it, and the attempt cap counts only sidecar lines from that offset on; the sidecar itself is not changed. Without this, a failure that outlasted the cap, such as a judge outage, stayed a zero for good. The resubmit also resets the auto-resume retry count, and the job id appears once in .gym_job_chain. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD — 1 BLOCKER and 5 RISK findings.
The default cache-disabled job can lose its existing rollout evidence when resubmitted. Additional issues affect concurrent resubmissions, GDPVal attempt budgets, offset cleanup, remote telemetry credentials, and preparation-error handling.
Reviewed all eight changed files and their directly affected execution/cache paths. Validation was static only: tests and suggested patches were not executed. Proposed corrections require author verification.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex
…rent and telemetry runs Address the review of gym eval resubmit: - A resubmitted job.sh now adds ++resume_from_cache=True once the resubmit offset exists, so a run configured without cache resume keeps its landed rollouts instead of clearing them as a fresh run. A job.sh staged before this change that would start fresh is refused when the run already has rollouts. - The scheduler check, the offset and retry resets and sbatch run as one remote script under a mkdir lock in the job dir, so two resubmits cannot both queue a job. - Every preparation step fails the script before sbatch: a resubmit whose offset cannot be written queues nothing and says why. - The resubmit exports the telemetry token named by the saved resolved config, as the first submit does, and fails before queueing when that token is not set. - A genuinely fresh run removes a stale resubmit offset with the old failures sidecar. - GDPVal's stage-aware resume gates and caps on attempts made since the offset, and keeps cumulative counts for attempt identities. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
prokotg
left a comment
There was a problem hiding this comment.
Review focused on the executor interface, since the job-management API is still in design.
Proposed BaseExecutor.resubmit (executors/base.py)
A SubmissionRecord describes a whole submission and holds one BenchmarkJob per benchmark (record.benchmarks). The run-level fields (run_dir, hostname, cluster, executor_metadata) are shared, and job_dir and job_id are per benchmark. So the call has to say which benchmark to resubmit. Two reasonable signatures, neither Slurm-specific:
Option 1: address the benchmark by name
@abstractmethod
def resubmit(self, record: SubmissionRecord, benchmark: str) -> BenchmarkJob:
"""Queue `benchmark` of a submitted run again, in place, and return it with its new job id.
Same config, same run: nothing is re-staged and finished work is kept. Must refuse while a
job of this benchmark is still active. Executors with no equivalent raise
`UnsupportedOperationError`.
"""The caller can't pass a benchmark that doesn't belong to the record, since the executor resolves the BenchmarkJob from record.benchmarks itself. It matches how a user would address the job (gym job id plus benchmark name), so the CLI doesn't have to depend on executor-specific paths.
Option 2: pass the BenchmarkJob
@abstractmethod
def resubmit(self, record: SubmissionRecord, benchmark: BenchmarkJob) -> BenchmarkJob:
"""Same contract as above; `benchmark` must be one of `record.benchmarks`."""The executor gets job_dir and the previous job_id without a lookup. The cost is that the signature allows a mismatched (record, benchmark) pair, so the contract has to state that benchmark belongs to record, and the executor should check it.
I lean toward option 1. Either way, the return value should be the updated BenchmarkJob and not a bare job id (see inline comment on slurm.py). Any future job-lifecycle operation (kill, status, etc.) should follow the same (record, benchmark) shape, so the CLI stays independent of the backend. Those are out of scope for this PR; this is only the pattern to keep them consistent with.
KubernetesExecutor (executors/kubernetes.py)
With resubmit abstract, KubernetesExecutor must now define it. Please add an explicit implementation that raises UnsupportedOperationError("Kubernetes executor does not support resubmit") and a test for it. That test is the one place we assert which executors support the operation.
Inline comments cover the dispatcher in submit.py, record lookup placement, the CLI handle, the return value, and the responsibilities inside SlurmExecutor.resubmit.
prokotg
left a comment
There was a problem hiding this comment.
Thank you! The following things are blocking, let me know if I misunderstood something:
- Resubmit is not part of the executor contract. submit.resubmit() hard-codes "slurm" and instantiates SlurmExecutor directly, bypassing _EXECUTORS. It should be an @AbstractMethod on BaseExecutor, dispatched through the registry, so support is declared by the executors themselves. This needs a signature decision, (record, benchmark: str) or (record, BenchmarkJob). KubernetesExecutor must also implement it and raise explicitly.
- The submission record isn't updated after a resubmit. resubmit returns a bare job id and only appends to .gym_job_chain. BenchmarkJob.job_id in gym-job.json and the local index still point at the old job. The method should return the updated BenchmarkJob and persist it.
- The CLI handle is Slurm-shaped. JOB_DIR is a filesystem path, and the lookup matches on it. While the job-management API is in design, the identifier should be executor-neutral (gym_job_id plus a benchmark name). Record lookup should also move out of submit.py into jobs.py.
- SlurmExecutor.resubmit owns responsibilities that aren't its own. It writes the rollout-collection attempt-budget offset with inline bash (wc -l), with the file format shared implicitly with rollout_collection. Run-state reset should live in one component outside the Slurm transport. In this PR "resubmit" should mean "queue the job again".
- Resubmit doesn't repeat what submit did. It drops compute.forward_env and re-parses resolved-config.yaml as raw YAML for the OTEL token. A resubmitted job can start with a different environment than the original submit.
Signed-off-by: Adam Rajfer <[email protected]>
…ates the record Address review of gym eval resubmit (executor contract, record, CLI handle): - resubmit is now an abstract BaseExecutor method, resubmit(record, benchmark) -> BenchmarkJob, dispatched on the record's executor name. KubernetesExecutor raises UnsupportedOperationError. - The Slurm executor returns the benchmark's updated entry and persists the record to gym-job.json and the local index through persist_record, the store persist() writes. It no longer appends to .gym_job_chain, which only the job script's own prologue writes. - The CLI takes `gym eval resubmit GYM_JOB_ID BENCHMARK`. The record lookup moves to jobs.load_submission_record: the local index, then the run's manifest when its run dir is on this machine. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Address review of gym eval resubmit (who resets run state, and repeating what submit does): - SlurmExecutor.resubmit only queues the job again: under its lock it checks that no job of the run is active, then runs sbatch with GYM_RESUBMIT=1. It no longer writes the attempt-budget offset or removes the retry file with inline shell. - The job does the reset when it starts. The auto-resume prologue clears its retry count and unsets the variable, so later chain hops are ordinary. The run step adds ++resubmit=True to gym eval run. - Rollout collection owns the offset file: resubmit=True implies resume_from_cache, and record_resubmit_offset() writes the offset atomically next to load_resubmit_offset(). The GDPval multistage resume uses the same function. - A run with rollouts whose job.sh predates this handling is refused, since that job.sh could start fresh and delete them. - The resubmit loads the saved resolved-config.yaml as a SubmitConfig and sends what run() sends ahead of sbatch: compute.forward_env and, when telemetry is on, the token from resolve_token(). A missing value fails before anything is queued. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
@prokotg Thanks for the review. All five blocking points are fixed, in two commits on top of a merge of main (needed for
Each point has a test that fails without it. Replies are on each thread. |
… records in one place The guard that refuses a populated run whose job.sh predates resubmit now applies only to a job.sh that runs the built-in `gym eval run`, the only runner whose fresh start deletes rollouts. A `command` benchmark's job.sh runs its own command and never carries the resubmit flag, so it was refused even when current. persist() and persist_record() now share one store path, so the local index first, then the run dir, and the failure message naming the queued jobs live in one place. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Resolve the GDPval attempt count: keep counting only attempts after the resubmit offset, and keep main's reverifiable failure classes out of the terminal set. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Resolve the two rendered-script fixtures: the resubmit line now comes before the driver watch that main gained in NVIDIA-NeMo#4785. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
@prokotg Thanks for the review! Both points are in d96b06e.
I also merged main twice to resolve the conflicts:
|
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39619980006 |
Main's #4766 changed the auto-resume block of resume_script.py. The one conflict is resolved by keeping main's job-chain file name and adding this branch's one-follow-up-per-job marker after it. The requeue tests pass on main's script. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Resubmitting a failed Slurm run in place meant running
sbatchon itsjob.shby hand and keeping the job chain up to date.Changes:
gym eval resubmit GYM_JOB_ID BENCHMARK. It queues one benchmark of an earlier submission again, in place, and prints the new job id.GYM_JOB_IDis the submission's id asgym eval submitreports it: the last part of its run directory, andgym_job_idin--json.resubmit(record, benchmark) -> BenchmarkJobis an executor operation. Executors that cannot resubmit raiseUnsupportedOperationError; today that is Kubernetes.<stem>_resubmit_offset. The failures sidecar itself is not changed.Tested with unit tests, using fake
sbatchandsqueuewhere needed, for:🤖 Generated with Claude Code