Repository navigation
fix(orchestration): uv on PATH, one resume follow-up per job, resubmit round trip, failed chain stops - #4840
Conversation
The uv installer does not write $HOME/.local/bin/env when that directory is already on PATH, so the driver preamble's source failed and set -e aborted the job although uv was installed. The env file only prepends $HOME/.local/bin to PATH, so the preamble now exports it directly. A new unit test checks the rendered script. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test ce28343 |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no reliability concerns.
The driver preamble now puts uv on PATH without depending on the optional env file, while preserving fail-fast setup and virtual-environment activation. The regression test checks removal of that dependency and ordering before virtual-environment creation.
Inspected both changed files and traced the shared Slurm and Kubernetes callers. No actionable findings. Static review only; tests were not executed.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
When Slurm requeues a job (a node failure, or preemption with --requeue), the job keeps its job id and runs job.sh again. The auto-resume prologue then queued a second follow-up with the same afternotok dependency, so two resume jobs started on one run directory when the job ended, and they could duplicate or corrupt rows. The prologue now takes a marker named after the job id, with an atomic mkdir, before it queues the follow-up. A requeued run of the same job finds the marker and queues nothing. A new segment of the chain has a new job id, so it still queues its own follow-up. If sbatch fails, the prologue removes the marker, so a requeue of that job can try again. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Main's NVIDIA-NeMo#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]>
gym eval resubmit validates the resolved config that submit persisted, and it refused that config in two ways: - persist() wrote host: env values back as references but dropped the lit: prefix, so each literal failed the env check. - driver.policy_model writes policy_base_url, policy_model_name and policy_api_key into each benchmark's run at submit. persist() saves them, and the validator then refused them as set by hand. The dump now writes lit: back on every literal; host: values stay references and runtime: values keep their own prefix, so no resolved secret reaches the record. _saved_config validates with a new saved_config context. In that context a bare env value reads as lit:, so configs saved before this change still load. That is safe because the earlier dump wrote only host: references, runtime: values and bare literals. The same context accepts a policy key that equals the value driver.policy_model derives. A differing value still conflicts, and a config written by hand is checked as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…s missing When the chain stopped because it reached max_walltime, or because the previous job was cancelled, the job exited 0. sacct then showed the last job COMPLETED, and readers took the run as done although rollouts were missing. The chain only takes these two stops after a job that did not finish the run: a job that finishes it COMPLETEs, and its follow-up never starts. So both stops now exit 1 with a message that says rollouts are missing and that a resubmit continues the run. The prologue cannot count rollouts itself (the expected total is only known to rollout collection), so it also writes .gym_chain_incomplete in the job dir with the reason. A job that continues the chain removes that marker. A chain whose previous job COMPLETED still exits 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD
Two RISK findings remain in the resubmit/requeue recovery paths: saved command benchmarks with a policy model still fail to reload, and an interrupted follow-up submission can permanently strand a requeued chain.
Completed the broad RESET review across all eight changed files and their directly affected callers, persistence contracts, and regression tests. The earlier uv PATH fix remains intact. Static review only; tests were not executed.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
Resolve the conflict in tests/unit_tests/test_eval_resubmit.py: both sides added tests at the end of the file, and both sets are kept. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…model driver.policy_model writes the policy keys into every benchmark's run at submit, and a command benchmark reads them as NEMO_GYM_POLICY_*. Its saved config therefore holds a command with a run, which the benchmark check rejected on reload, so resubmit queued nothing. On a saved config, a command may now keep exactly the keys derived from a model service, and the existing check still rejects a value that differs. A hand-written command with a run, or a saved one with any other run key, is still refused. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/review reset=true |
Picks up the unit-test runner pin to Ubuntu 24.04 (NVIDIA-NeMo#4971) and the Terminus interrupt test fix (NVIDIA-NeMo#4966), so CI runs on the current main. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39955672662 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39957835018 |
The uv installer does not write
$HOME/.local/bin/envwhen$HOME/.local/binis already onPATH. The driver preamble then fails onsource "$HOME/.local/bin/env", andset -eaborts the job although uv was installed.The env file only prepends
$HOME/.local/bintoPATH, so the preamble now doesexport PATH="$HOME/.local/bin:$PATH"directly.Tests:
test_render_driver_entrypoint_puts_uv_on_path_without_env_filechecks that the rendered script no longer references.local/bin/envand puts$HOME/.local/binonPATHafter the uv install and beforeuv venv. It fails on the previous code.Also: one auto-resume follow-up per Slurm job. The auto-resume part of the job script queues its follow-up with
sbatch --dependency=afternotok:$SLURM_JOB_ID. A Slurm requeue keeps the job id and runs the script again, so it queued a second follow-up, and both started on the same run directory when the job ended. The script now creates a marker directory.gym_followup_queued.$SLURM_JOB_IDwithmkdir, which is atomic, before it callssbatch. A requeued job finds the marker and queues nothing. A new segment has a new job id and still gets its follow-up. Ifsbatchfails, the marker is removed, so a later requeue can try again. This is the same job script and the same reviewer as the change above.Tests:
test_a_requeued_job_does_not_queue_a_second_follow_up(a first segment and a resumed segment),test_each_resumed_segment_still_queues_its_own_follow_upandtest_a_requeue_retries_a_follow_up_that_failed_to_submit. They run the rendered script in bash with fakesacctandsbatch. All but the retry test fail on the previous code.Also:
gym eval resubmitloads the config thatgym eval submitsaved. Resubmit refused every saved config with alit:env value or adriver.policy_model, so nothing was queued.persist()puthost:values back as references but wrote literals without their prefix. It now writeslit:back.host:values stay references, so no resolved secret reaches the record._saved_configloads with a saved-config context, so a file saved before this fix, with bare literals, still loads.driver.policy_modelvalidator wrotepolicy_base_url,policy_model_nameandpolicy_api_keyintobenchmark.runat submit. Re-validation of the saved file then refused them as set twice. Values that equal whatdriver.policy_modelderives are now accepted when loading a saved config. A differing saved key, or hand-written policy keys, still conflict.commandbenchmark gets the same three keys in itsrunand reads them asNEMO_GYM_POLICY_*, so its saved config holds a command with arun, which the benchmark check refused. On a saved config, a command may now keep exactly the keys derived from a model service, and the equality check above compares their values. A hand-written command with arun, or a saved one with any other run key or without a model policy, is still refused.Tests in
tests/unit_tests/test_eval_resubmit.py:test_the_config_submit_saves_loads_back_as_resubmit_loads_it, through the realSlurmExecutor().persistand_saved_config;test_resubmit_queues_a_run_submitted_with_lit_env_and_a_policy_model,gym eval resubmitagainst stubsqueueandsbatch;test_a_config_saved_with_bare_literals_still_loads;test_a_run_with_a_policy_model_and_no_env_loads_back;test_a_saved_command_benchmark_with_a_policy_model_loads_back_and_resubmits.Each fails on the previous code. The refusals keep their own tests: a saved command with a differing policy value, with an extra run key, or without a policy model, and a hand-written command with a
run.Also: a chain that stops with rollouts missing fails. When the auto-resume chain stops at the
max_walltimecap, or after a cancel, the job used to exit 0, so the run read as done. It now exits non-zero, with a message to resubmit, and writes.gym_chain_incompletenext to the run. A chain that continues clears the marker; a chain that finished still exits 0. Tests:test_a_chain_stopped_at_the_walltime_cap_exits_non_zero_and_marks_the_run_incomplete,test_a_chain_stopped_after_a_cancel_exits_non_zero_and_marks_the_run_incompleteandtest_a_chain_that_continues_clears_an_earlier_incomplete_marker. A resubmit gives the chain a fresh walltime budget, as it already gives a fresh retry count, so "resubmit to continue" gets past the cap:test_a_resubmitted_job_starts_a_fresh_walltime_budget.This branch now contains main, merged in, because main's
gym eval resubmitchanged the same files.🤖 Generated with Claude Code