Repository navigation
Conversation
…ob dir once per Slurm job Opt-in per benchmark (node_local). The driver and the servers it starts get GYM_NODE_LOCAL_DIR, a directory on the driver node's own disk, mounted at a path that is the same in every job of the run. When the driver step ends it is written to <benchmark dir>/node-local/<SLURM_JOB_ID>.tar.gz and removed; the next job restores the newest archive first (restore, on by default). A step at its time limit is killed within moments of the TERM, so the watch loop stops the driver stop_before_walltime_seconds before the job's end time, archives, and waits for the limit: the job still ends TIMEOUT. A lost service, a failed or finished driver, and a TERM on the batch node also archive. Signed-off-by: Wojciech Prazuch <[email protected]>
…n restore is on With restore each archive holds the run's whole node-local dir, so a run of N segments kept N growing copies. After an archive is in place, delete the numeric archives older than the previous one: the newest and the one before it (restore's fallback) stay. Without restore every archive holds only its own segment's files and all are kept. A failed archive prunes nothing. Signed-off-by: Wojciech Prazuch <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD
I found one BLOCKER and four RISK findings. A trailing newline in base_dir can make cleanup delete the configured base directory rather than this job's subdirectory. The other findings affect restore safety and when archives become available to exports.
I inspected all eight changed files and traced the affected resume and export paths. This was a read-only source review. I did not execute tests or validate the rendered script on a Slurm cluster; the regression checks below are proposed.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Inline comments (escaped v1):
-
nemo_gym/orchestration/api.pyline 491: BLOCKER: reject a trailing newline inbase_dirNodeLocalConfig(base_dir="/scratch/alice\n")passes because Python's$anchor can match before a final newline. A YAML|block scalar supplies that newline naturally. render_setup then emits:_gym_nl_dir=/scratch/alice /gym-node-local-"$SLURM_JOB_ID"The batch shell does not enable
errexit, so setup continues after the second command fails. The restore script runsrm -rf -- /scratch/alice, deleting unrelated writable files instead of only the per-job directory. With/tmp\n, it attempts the same cleanup against/tmp.Could you require a full-string match?
if not _NODE_LOCAL_BASE_DIR_RE.fullmatch(value) or "/../" in f"{value}/":Every accepted value must remain one safe shell word before the job suffix is appended. Preserve valid
/tmpand/raid/scratch/, including trailing-slash normalization, and existing rejection of traversal, commas, colons and spaces.Proposed checks:
/tmp\nand/raid/scratch/\nmust raise thenode_local.base_dirvalidation error before rendering. Valid paths must still render a directory ending in/gym-node-local-"$SLURM_JOB_ID". The suggestion is source-reviewed, not executed. -
nemo_gym/orchestration/executors/node_local.pyline 54: RISK: stop instead of silently continuing after every restore failsWith
restore: true, create numeric archives9.tar.gzand10.tar.gzthat both fail extraction. This loop removes each partial extraction, then reports “No earlier archive” and returns success. The resumed driver therefore starts with an empty directory even though saved results may reference files from earlier jobs. A subsequent successful archive publishes that incomplete directory as the newest run snapshot. An empty first run and an unrecoverable restore need different outcomes.Could you fail when matching archives exist but none extracts, and propagate that failure from
_SETUP_TEMPLATEbefore starting the driver? Returning nonzero inside_RESTORE_SCRIPTalone is insufficient because the setup caller currently ignores its status.A small correction is to initialize
found=0before the loop, setfound=1at the start of its body, and insert this before the final empty-directory message:[ "$found" = 0 ] || { echo "ERROR: no node-local archive could be restored from $archives" exit 1 }
Append
|| exit $?to the restore invocation in_SETUP_TEMPLATE. This also propagates its existing directory-creation failure.Proposed regression: with two unreadable archives, assert that a driver sentinel is never created, no new archive is published, and both old archives remain. Preserve an empty first run,
restore: false, and fallback from a bad newest archive to a valid older one. The existing fallback case must still restoreev/0.jsonwithout keeping partially extracted files from the failed attempt. -
nemo_gym/orchestration/executors/node_local.pyline 78: RISK: retain the known-good restore source as the fallbackStart with valid
9.tar.gzand corrupt10.tar.gz. Job 11 correctly falls back to archive 9, but this numeric pruning keeps 11 and the already-known-bad 10, deleting 9. If 11 subsequently fails extraction, the advertised fallback is unusable even though this job knew which older archive worked.Could you carry the successfully extracted archive's identity into retention and keep it alongside the newly published archive? The invariant is that publishing a new snapshot must not delete the known-good fallback in favor of an archive that failed restoration. The exact handoff between the restore and archive subprocesses needs implementation verification, so I am not suggesting a one-line pruning change.
Preserve numeric newest-first selection when archives are valid, the two-archive bound after successful publication, no pruning after a failed archive, and keeping every archive with
restore: false.Proposed regression: extend the fallback test to assert that job 11 leaves valid archives 9 and 11, not corrupt 10. Corrupt 11 afterward and verify that the next job can still restore
ev/0.jsonfrom 9. Retain the existing valid-history assertion that archives 10 and 11 are kept, and the failed-archive assertion that nothing is pruned. -
nemo_gym/orchestration/executors/slurm_script.pyline 802: RISK: keep polling the archive deadline after service loss during exportsWith
node_localand exports enabled, let evaluation succeed, let a watched service exit, and keep the exporter running beyond the archive deadline. This success-marker branch blocks inwait "$_gym_driver_pid"; its caller then returns, so the new deadline check never runs. Off the batch node, the job can reach its time limit without an archive because that placement has no TERM archive trap. On the batch node, it loses the reserved early archive window.Could you make service loss after evaluation success disable service supervision without leaving the driver/deadline polling loop? Handle the race where the marker appears between the caller's service check and this helper. An outer marker check alone does not cover it. The helper needs a distinct continue-watching outcome; the exact change needs verification rather than a speculative one-line replacement.
Preserve service loss before success stopping the driver with status 1, an already-exited driver keeping its status, and uninterrupted exports after success.
Proposed regression: create the success marker immediately, end the service before the five-second poll, put the archive deadline after that poll, and run exports beyond it. Assert that the archive appears while exports still run, no TERM reaches the driver, and its eventual exit status stands. Cover off-batch placement. Retain the existing service-loss-before-success and simultaneous driver/service-exit assertions in the supervision tests.
-
nemo_gym/orchestration/executors/slurm_script.pyline 1290: RISK: publish the evidence archive before the post-run directory export startsFor
node_local: truewithjob.export.evalrdl: {}, let evaluation write evidence and finish well before the archive deadline. The export tail runs inside the driver step, but this wrapper archives only after that entire step ends. EvalRDL receives the benchmark directory and uploads it as it is. The current job's evidence archive does not exist there yet, so a successful export omits it. Its recorded success prevents a later retry after the archive arrives.Could you coordinate
render_export_tailand the batch wrapper with an archive-before-export barrier? Publishing the archive must finish before an exporter snapshots the benchmark directory. Creating the success marker alone is not a barrier because export starts immediately afterward. Define how archive failure releases the barrier without hanging. The synchronization implementation needs verification, so no patch is suggested here.Preserve post-driver archiving for failed/interrupted evaluations, single publication per job, the evaluation's exit status, no exports after evaluation failure, and unchanged rendering when
node_localis off. Keep the mounted files available if an exporter still reads them.Proposed regression: have a fake successful evaluation write one evidence file and a fake exporter inspect
node-local/<job>.tar.gzat invocation. Assert that the archive already exists and contains that file, even when evaluation ends before the deadline. Also retain the existing assertion that deadline archiving does not terminate running exports.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
detect-secrets reads the job-dir path in this assertion as a high-entropy string. Signed-off-by: Wojciech Prazuch <[email protected]>
…already archived Seen on a cluster smoke: the deadline stop archived the dir, and the TERM at the time limit then claimed to archive it again. Signed-off-by: Wojciech Prazuch <[email protected]>
The regex's `$` also matched before a final newline, which a YAML block scalar supplies. The rendered dir then split across two lines and the restore's cleanup could reach base_dir itself. Match the whole string instead. Signed-off-by: Wojciech Prazuch <[email protected]>
…e restores With restore on, archives that all fail to extract fell through to an empty dir, and the next archive published a run without the files saved results may name. The restore now exits 1 when archives exist but none extracts, and the job stops before the driver (a failed mkdir stops it too). An empty first run, restore off, and the fallback to an older archive are unchanged. Signed-off-by: Wojciech Prazuch <[email protected]>
…he node-local TERM test The fake driver could die of the TERM before the job's trap ran; the loop then saw it gone and archived on the after-driver path, so the trap's message was missing about one run in three. A step outlives the TERM until Slurm kills it. Signed-off-by: Wojciech Prazuch <[email protected]>
With a valid 9 and a broken 10, job 11 restored from 9 but pruning kept the two newest, 10 and 11, and deleted the only good fallback. The restore now records the archive it extracted next to the node-local dir; after a successful publish the archive step keeps the new archive and that one, and deletes the other older numeric archives. With no record it keeps the newest older one, as before. Signed-off-by: Wojciech Prazuch <[email protected]>
…a lost service Once the evaluation had succeeded, a lost service sent the watch into a plain wait for the driver, so the deadline check stopped and a long export could reach the time limit with nothing archived (off the batch node there is no TERM archive). That branch now keeps running the extra check every 5 s until the driver ends, then returns its status. It is rendered only with an extra check: without node_local the script is byte-identical. Signed-off-by: Wojciech Prazuch <[email protected]>
…d the job dir The exports ran in the driver step and the archive only after it, so an exporter of the benchmark dir uploaded it without this job's archive and recorded success. With node_local and exports, the watch now archives as soon as the evaluation has succeeded, then writes a barrier file in the bench dir; the export tail waits for it (archive_timeout_seconds plus a minute), and a failed archive releases it too. The dir is removed only after the driver step, since exporters may read it. Failed or interrupted runs still archive after the driver, once per job. Without node_local nothing is rendered differently. Signed-off-by: Wojciech Prazuch <[email protected]>
…as one (#6218) artifacts_dir now defaults to $GYM_NODE_LOCAL_DIR/agentic_if when the env var is set (a submitted benchmark with node_local), and to <results_dir>/agentic_if otherwise, as before. agentic_if_artifacts_dir still wins. The episodes then leave shared storage; each Slurm job archives them into the job dir and later jobs, including the recovery re-grading job, restore the newest archive. The benchmark README says how to re-verify such a run outside the job. Signed-off-by: Wojciech Prazuch <[email protected]>
ananthsub
left a comment
There was a problem hiding this comment.
Keeping the evidence files on the driver's node and writing one archive per Slurm job is the right shape for shared storage: the archive is compressed on the node, copied once under a distinct name, and extracted only onto node-local disk. The gaps are in what happens when an archive is missing, cut short, or too large, because in each case the run continues while saved rows name files that no archive holds anymore.
Two changes would close most of them:
- Archive each job's own files, and restore all of the run's archives in job-chain order. Today each archive holds the whole directory of the run so far. That design is what makes a failed extraction fall back and then delete the newer archive. It also makes every later job drop its archive once the directory outgrows
archive_timeout_seconds, and it makes the order depend on numeric job IDs. With one archive per job, nothing is pruned, the size stays per job, and a missing archive can stop the job instead of being skipped. - Move the stop before the time limit into its own PR. It changes the lifecycle of every job that sets
node_local: the driver stops early and the allocation waits idle. Slurm's--signal=B:USR1@<seconds>may be a simpler trigger than readingEndTimeonce and polling. The same stop is the natural place to shut down the OpenTelemetry collector from #6215, which today depends on the time limit to stop and append its files. A separate review would keep that decision apart from the storage change.
The description says the change has not run on a cluster yet. One real Slurm run with restore across at least two jobs, one of them ending at the time limit, would show that the EndTime parsing, the archive steps off the batch node, and the restore behave as the fake srun and scontrol tests assume. The agentic_if README now in this PR relies on "the newest archive holds them all", so these points apply to it as well.
| for name in $(ls -1 "$archives" 2>/dev/null | grep -xE '[0-9]{1,15}[.]tar[.]gz' | sort -rn); do | ||
| found=1 | ||
| if tar -xzf "$archives/$name" -C "$dir"; then | ||
| echo "Restored the node-local dir from $archives/$name" | ||
| echo "$name" > "$dir.restored-from" | ||
| exit 0 | ||
| fi | ||
| echo "WARNING: cannot extract $archives/$name; trying an older archive" | ||
| rm -rf -- "$dir" && mkdir -p -m 700 -- "$dir" || exit 1 |
There was a problem hiding this comment.
RISK: one failed extraction of the newest archive makes the job continue from older files and then delete the newer archive
When the newest archive does not extract, the restore falls back to an older one and the driver starts anyway. Later, the archive step prunes every archive older than this job except the one it restored from, so the newer archive that failed to extract is deleted.
For example, the archives directory holds 9.tar.gz and 10.tar.gz, and extracting 10.tar.gz fails once because of a read error on shared storage, or because the node's disk fits archive 9 but not archive 10. Job 11 restores 9, runs, writes 11.tar.gz without job 10's files, and removes 10.tar.gz. Job 10's rows stay saved in the rollouts file and resume skips them, but the files those rows name are now in no archive. With the PR's own scripts and GNU tar, the log reads cannot extract …/10.tar.gz, Restored the node-local dir from …/9.tar.gz, Removed the superseded archive …/10.tar.gz, and the job exits 0.
The fallback breaks the rule the restore states a few lines below (L66), which is that an incomplete directory publishes a run without the files its saved rows name. The same pruning also removes the fallback after a Slurm requeue of a run without resumable. A requeue keeps SLURM_JOB_ID, so job 11 restores 11.tar.gz, overwrites it, and deletes 10.tar.gz.
Could the restore try the newest archive a second time and then stop the job, as it already does when no archive extracts? Retention can then simply keep the newest two archives, and the .restored-from record is no longer needed.
There was a problem hiding this comment.
Fixed. No fallback and no pruning. Any archive that does not extract stops the job.
| else | ||
| rm -f -- "$tmp" | ||
| echo "WARNING: archiving the node-local dir failed (exit $rc); its files from this job are lost" |
There was a problem hiding this comment.
RISK: once the run's directory outgrows archive_timeout_seconds, every later job drops its archive, and only a warning says so
With restore on, each Slurm job extracts the whole directory of the run so far and then archives all of it again. Writing the archive is bounded by a fixed archive_timeout_seconds (120 s by default), but the directory grows with every job of the run. A plain gzip of JSON-like files ran at about 13 MB/s on a workstation, so the default bound covers roughly 1.5 GB.
From the first job whose directory is larger than that, the archive is killed and dropped, and the job still exits 0 with WARNING: archiving the node-local dir failed (exit 137); its files from this job are lost. The next job restores the last archive that did fit, adds its own files, and overruns the bound again. From then on every later job's files are lost, while resume treats their rows as done. agentic_if episodes, which this PR now keeps in the node-local directory, store a sandbox bundle, records and judge calls per episode, so a long run can reach this size.
The order of archives rests on a related assumption. Restore and pruning order archives by numeric job ID (L56, L98), but Slurm wraps job IDs back to a low number at MaxJobId. A job started after the wrap therefore restores a stale archive and prunes the newer one. The re-verification recipe in benchmarks/agentic_if/README.md picks the newest archive the same way (sort -n | tail -n 1).
Could each job archive only the files it added, and could restore extract every archive of the run in job-chain order? The resume chain already records that order in .gym_job_chain (resume_script.py). Each archive would then hold one job's files, so its size would not grow with the run. Nothing would need pruning, and a missing or failed archive could stop the job instead of being skipped.
There was a problem hiding this comment.
Fixed. Archives are per job (<job id>.<restart>.tar.gz), restored in .gym_job_chain order.
| trap '' TERM | ||
| dir=$1 archives=$2 job=$3 limit=$4 restore=$5 | ||
| [ -d "$dir" ] || { echo "WARNING: no node-local dir $dir to archive"; exit 0; } | ||
| tmp="$archives/.$job.tar.gz.tmp" |
There was a problem hiding this comment.
RISK: an archive started on TERM has only Slurm's KillWait to finish, and a cut-off archive leaves a partial file on shared storage
trap '' TERM keeps the archive running after TERM, but Slurm sends SIGKILL KillWait seconds later (30 s by default), and no process can ignore that signal. Preemption with GraceTime follows the same sequence. A cancelled or preempted job therefore has about 30 s to archive, not the 120 s of archive_timeout_seconds. The 300 MB test in the description shows that the archive survives TERM, but not that it finishes before the SIGKILL.
When the SIGKILL lands mid-archive, node-local/.<jobid>.tar.gz.tmp stays in the benchmark directory on shared storage. Restore and pruning match only <digits>.tar.gz, so no later job removes the partial file, and it can be as large as a full archive. Each cancelled job of the run can leave one more.
Could the restore remove .*.tar.gz.tmp from the archives directory? It already lists that directory, and no two jobs of one run are live at once, so a partial file there is always left over. The node_local docs should also say that an archive started on TERM must finish within the cluster's KillWait.
There was a problem hiding this comment.
The restore removes leftover .tmp archives, and the docs say a TERM archive must finish within KillWait. #6296 adds a stop before the time limit.
| rm -rf -- "$dir" && mkdir -p -m 700 -- "$dir" || { echo "ERROR: cannot create the node-local dir $dir"; exit 1; } | ||
| [ "$3" = 1 ] || exit 0 | ||
| found=0 | ||
| for name in $(ls -1 "$archives" 2>/dev/null | grep -xE '[0-9]{1,15}[.]tar[.]gz' | sort -rn); do |
There was a problem hiding this comment.
RISK (question): a failed listing of the archives directory reads as "no archive yet"
ls -1 "$archives" 2>/dev/null prints nothing both when the directory does not exist and when listing it fails. In both cases found stays 0, the restore prints No earlier archive …: the node-local dir starts empty, and the driver starts with an empty directory. That bypasses the check this PR added for archives that exist but do not extract.
If listing fails once, for example with an I/O error after a Lustre client eviction, job 11 runs empty and writes 11.tar.gz with only its own files. Job 12 then restores 11.tar.gz and prunes 10.tar.gz, the last archive that held the earlier files. A metadata stall usually blocks ls rather than failing it, so it is unclear how often this path is reached, but when it is, the run loses its whole history.
Could the restore treat only a missing directory as "no archive", and stop the job when listing an existing directory fails?
if [ -d "$archives" ]; then
names=$(ls -1 "$archives") || { echo "ERROR: cannot list $archives; the driver does not start"; exit 1; }
fi
for name in $(printf '%s\n' "$names" | grep -xE '[0-9]{1,15}[.]tar[.]gz' | sort -rn); doThis is a plain block rather than a suggestion because the change also adds lines above the anchored one.
There was a problem hiding this comment.
Fixed. Only a missing dir means "no archive yet". A failed listing stops the job.
| if [[ -z "$_gym_nl_done" && -e "${{GYM_EVAL_SUCCEEDED_MARKER:-}}" ]]; then | ||
| echo "The evaluation succeeded: archiving the node-local dir before the exports read the job dir." | ||
| _gym_nl_archive | ||
| fi |
There was a problem hiding this comment.
NOTE: after a Slurm requeue, the earlier attempt's success marker makes the job archive at its first poll
eval.succeeded.<jobid> and .gym_node_local_archived.<jobid> are named only by SLURM_JOB_ID, which a requeue keeps, and nothing removes them before the driver starts. A run with resumable stops a requeued job in its prologue, before this setup runs, so only runs without resumable reach this path.
Take such a run with exports whose first attempt succeeded and was then requeued while its exports ran. The second attempt finds the old marker at its first watch poll, archives the directory it has just restored, and sets _gym_nl_done. Because of that flag, the archive after the driver step is skipped, and the cleanup then deletes the directory, so the second attempt's files are lost. The old barrier file also lets the exports skip their wait.
Could the setup remove both files before the driver starts? A first attempt has neither file, so this changes nothing else.
There was a problem hiding this comment.
Fixed. The setup removes both markers before the driver starts.
| def test_a_service_lost_after_the_evaluation_succeeded_still_lets_the_deadline_archive(tmp_path, off_batch): | ||
| # The service dies once the evaluation has succeeded and before the poll that reaches the deadline (3 s on); the | ||
| # exports then run on, so only a watch that keeps polling archives before the driver step ends. |
There was a problem hiding this comment.
NOTE: the test name and comment still describe the deadline
Since the last commit, the archive in this test comes from the success-marker branch of _gym_nl_watch, not from the deadline. Could the name and comment say that the watch still archives after a lost service once the evaluation has succeeded?
There was a problem hiding this comment.
Renamed to test_a_service_lost_after_the_evaluation_succeeded_still_lets_the_watch_archive.
| assert "_gym_nl_archives=/jobs/20261116_run/b/node-local" in script # pragma: allowlist secret | ||
|
|
||
|
|
||
| def test_the_dir_is_set_up_before_the_driver_and_archived_after_it(): |
There was a problem hiding this comment.
NOTE: several rendering tests repeat the script text instead of checking behavior
This test matches the exact five-line block after the driver. test_restore_can_be_turned_off_and_then_no_archive_is_pruned, test_the_watch_loop_stops_the_driver_before_the_time_limit, and the literal _gym_i < 180 in test_the_exports_wait_for_the_archive_only_with_node_local do the same. Tests that run the rendered job already cover each of these behaviors, so the text matches fail on any rewording without catching anything more. The placement tests (--nodelist in _gym_nl_run) should stay, because the fake srun cannot show which node a step runs on.
There was a problem hiding this comment.
Dropped. Behavior tests cover them, and the placement tests stay.
| | `run` | `{}` | Overrides forwarded to `gym eval run`. | | ||
| | `command` | `null` | A shell script that runs **instead of** `gym eval run`. See [Custom Harness](/orchestration/how-to/custom-harness). Cannot be combined with `run` or `resumable`. | | ||
| | `resumable` | `false` | `true` for auto-resume with defaults, or `{max_retries, max_walltime}` to tune it. See [Resumable Runs](/orchestration/how-to/resumable-runs). | | ||
| | `node_local` | `false` | `true`, or a mapping, gives the driver a directory on its node's own disk, archived into the job dir once per Slurm job. Slurm only. See [node_local](#node_local). | |
There was a problem hiding this comment.
NOTE: this row says "job dir", and the section it links to says "benchmark dir"
The row says the directory is "archived into the job dir", but the node_local section and the rest of this page call the same place <benchmark dir>, and the job record calls it the benchmark's directory inside the run directory. Could the row say "archived into the benchmark directory"? job_dir stays fine in code, where it matches the field name.
| from nemo_gym.orchestration.executors.script_templates import NODE_LOCAL_ARCHIVED_ENV | ||
|
|
||
|
|
||
| NODE_LOCAL_DIR_ENV = "GYM_NODE_LOCAL_DIR" |
There was a problem hiding this comment.
NOTE: user code reads this variable, but the driver's other variables for user code start with NEMO_GYM_
Configs and harnesses are meant to read GYM_NODE_LOCAL_DIR, for example through ${oc.env:GYM_NODE_LOCAL_DIR}. The variables the driver already gives user code are NEMO_GYM_BENCH_DIR and NEMO_GYM_POLICY_* (custom-harness.mdx), while the GYM_ prefix marks values internal to the script, such as GYM_CMD and GYM_EVAL_SUCCEEDED_MARKER. Could this one be NEMO_GYM_NODE_LOCAL_DIR, with a row in the custom harness page's variable table? The name has not shipped yet, so renaming it now needs no alias; the agentic_if config in this PR would change with it.
There was a problem hiding this comment.
Renamed to NEMO_GYM_NODE_LOCAL_DIR.
| _gym_nl_archive | ||
| _gym_nl_cleanup | ||
| echo "Waiting for the time limit: the job ends TIMEOUT, as a segment that ran to its limit does." | ||
| while :; do sleep 60 & wait $!; done |
There was a problem hiding this comment.
NOTE: the stop before the time limit leaves the OpenTelemetry collector to be killed, although it waits 300 s with nothing to do
#6215, now on main, runs the OpenTelemetry collector from its own directory in node /tmp and appends its JSONL files into <job dir>/otel/ only when the collector shuts down cleanly (slurm_script.py). That shutdown runs in the batch script after the driver step returns. This function never returns: after it archives the node-local directory, it waits until the time limit. Slurm then ends the job, so the collector's append either races KillWait or, if its step is killed outright, never runs, and the job can lose the telemetry it collected. A job without node_local that reaches its time limit on main loses it the same way, so this is not a new loss. But this function already gives the job a clean stop several minutes before the limit, and the collector is the other node-local directory that needs one.
The two paths also choose their node directory differently. The collector uses a fixed mktemp -d /tmp/gym-otel-$SLURM_JOB_ID.XXXXXX and GYM_OTEL_LOCAL_DIR, while this PR uses a configurable base_dir and GYM_NODE_LOCAL_DIR. A cluster that needs node-local files under /raid/scratch would have to configure one and could not configure the other.
Could this function run the collector's shutdown before it waits for the limit, so that one deadline stops both? The collector's directory could then also be created under node_local.base_dir when the benchmark sets it, which gives one setting for where the job's node-local files live.
There was a problem hiding this comment.
Moved to #6296, which shuts the collector down cleanly on the same signal.
With node_local, model_call_capture_dir now defaults to the node-local dir's model-calls subdirectory, so the per-call capture writes and claims stay on the driver's disk and reach the job dir inside the archive. An explicit model_call_capture_dir still wins. Signed-off-by: Wojciech Prazuch <[email protected]>
Resolves the driver srun line: keeps main's explicit --account and this branch's node-local mount and env. The node-local steps off the batch node now pass the account too. Signed-off-by: Wojciech Prazuch <[email protected]>
The stop changes the lifecycle of every node_local job, so it moves to its own change, which will stop on a Slurm --signal=B:USR1 and also shut down the OpenTelemetry collector. This removes stop_before_walltime_seconds, the EndTime read, the deadline in the watch loop and the wait for the limit. The archive after the driver step, the archive once the evaluation has succeeded and the TERM trap on the batch node stay. Signed-off-by: Wojciech Prazuch <[email protected]>
…re them all Each job now archives only the files it added or changed since its restore (a stamp next to the host dir; restored files keep the ctime of their extraction), as <job id>.<restart count>.tar.gz, so a requeued attempt keeps its earlier attempt's archive. The restore extracts every archive of the run: the job chain's order first, then archives it does not name by job id, attempts in order. A chain job without an archive gets a note. Nothing is pruned, and .restored-from is gone. A failed listing of an existing archives dir, an unreadable job chain or an archive that does not extract stops the job before the driver; only a missing dir means no archive yet. The restore also removes partial archives a job cut off mid-archive left. The agentic_if re-verify recipe extracts every archive in the same order. Signed-off-by: Wojciech Prazuch <[email protected]>
…archive leaves The node_local section now says that only gym eval submit jobs on Slurm set NEMO_GYM_NODE_LOCAL_DIR (not a local gym eval run, not NeMo RL), that only the driver container sees it, that saved rows keep naming files a lost archive took with it, that an archive started on TERM must finish within the cluster's KillWait, and how to pick base_dir. The container path says <gym job id>, as the rest of the page does. Signed-off-by: Wojciech Prazuch <[email protected]>
File change times tick coarsely on Linux (and in whole seconds on some file systems), so a file written right after the stamp could share its time and be left out of the job's archive. Waiting one second after the stamp keeps every later write newer. Signed-off-by: Wojciech Prazuch <[email protected]>
… runner The fake tar sleeps 3 s and the test's archive bound was 5 s, so a busy CI runner could time the archive out. Signed-off-by: Wojciech Prazuch <[email protected]>
…TERM No export runs after a TERM (a time limit, a cancel), so the marker the archive created stayed in the job dir. The TERM handler now removes it. Signed-off-by: Wojciech Prazuch <[email protected]>
Main moved the Slurm executor, the resume script and the recovery planner (#6228). Carries this branch's node-local support, its restore-failure kind and remedy, and its tests to the new modules. Signed-off-by: Wojciech Prazuch <[email protected]>
…tors/slurm Signed-off-by: Wojciech Prazuch <[email protected]>
…covery Signed-off-by: Wojciech Prazuch <[email protected]>
Brings #6217's merge of main (#6228 moved the Slurm executor, resume script and recovery planner); node_local keeps this branch's stop-wait import. Signed-off-by: Wojciech Prazuch <[email protected]>
|
All five Autobot findings are fixed: |
|
Both changes from the review summary are done. Each job archives only its own changes, the restore extracts all archives in job-chain order, and the stop is now its own PR, #6296. |
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
I verified all five findings from the previous review against the current source:
base_dirvalidation usesfullmatch, rejecting the trailing-newline trigger.- Restore failures stop setup before services start instead of continuing empty.
- Archive publication no longer prunes the known-good restore source.
- Service-loss handling keeps the archive check running after evaluation success. The former deadline mechanism has been removed.
- The export tail waits for the archive step to finish before invoking exporters.
I compared the fixes and directly affected subsequent changes with 4dabeeb1ca2524538290ce3a2af90020ad813fed, including their regression tests and recovery consumers. I found no unresolved prior findings or introduced regressions above the historical high-impact ceiling. This was a follow-up review, not a fresh whole-PR review.
This was a read-only source review. I did not execute tests or validate the current scripts on Slurm.
Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.
There was a problem hiding this comment.
I understand the motivation although I have few questions regarding the proposed changes. Mostly because it's a lot of code being added with a risk path for tarring.
- What did you measure? Was it metadata operations per second on the MDS, write throughput, or job slowdown?, and at what scale (episodes per run, concurrent workers)? Buffering only helps if the bottleneck is data bytes, so this decides the question.
- Did you try a simpler fix first? For example, packing episodes into one JSONL or sqlite file per worker or per job, or writing the files to /tmp and tarring them at the end inside the benchmark. If so, why did that not work?
- Which benchmarks need this besides agentic_if? If it is only agentic_if, why does the fix live in orchestration (about 1.2k lines) instead of in the benchmark?
- Does model-call capture need to move too? Is it a real load source, or did it come along because it was easy to redirect?
- A job that ends without archiving, such as a failed node or an archive cut off at KillWait, silently loses its files. The PR doc says "nothing reports the loss until something reads the files." Is that acceptable for runs that produce results people rely on? Could the loss be detected at resume time instead?
- When the time limit hits a job whose driver is not on the batch node, the archive can't run. How common is that layout in practice?
- The incremental archive relies on ctime newer than a stamp. Is that reliable if the restore or an extraction changes ctimes, or if the tar happens on a different clock or file system than the stamp?
Signed-off-by: Wojciech Prazuch <[email protected]>
… time limit (#6296) * feat(orchestration): keep the OTel collector's node files under node_local.base_dir When a benchmark sets node_local, the collector's node directory is created under node_local.base_dir instead of /tmp, so one setting places all of the job's node-local files. A collector container gets base_dir mounted. Without node_local the collector stays in /tmp. Signed-off-by: Wojciech Prazuch <[email protected]> * feat(orchestration): stop the node-local driver on Slurm's USR1 before the time limit node_local.stop_before_walltime_seconds (default 420, 0 turns it off) adds #SBATCH --signal=B:USR1@<seconds>. On USR1 the batch shell stops the driver (TERM, up to 60 s), archives the node-local dir, stops the OTel collector once so it appends its files, removes the dir, and waits for the time limit, so the job still ends TIMEOUT. Off the batch node these run as steps on the driver's node, which can still start then. A driver that already ended, or is past its evaluation, keeps the job's status; a running archive finishes first and is not repeated. A USR1 before the stop is set up, or during the driver's launch, is noted and acted on. The window must cover archive_timeout_seconds + 60 + 140 + 60 + 30. Signed-off-by: Wojciech Prazuch <[email protected]> * test(orchestration): give the USR1-during-archive test room on a loaded runner The fake tar sleeps 3 s and the test's archive bound was 5 s, so a busy CI runner could time the archive out. Signed-off-by: Wojciech Prazuch <[email protected]> * fix(orchestration): hold a USR1 across the collector's launch until its PID is known A USR1 between the collector's background srun and its PID capture ran the stop with no collector PID, so the collector missed its clean shutdown. The launch now takes the same guard as the driver's. Signed-off-by: Wojciech Prazuch <[email protected]> --------- Signed-off-by: Wojciech Prazuch <[email protected]>
…-local-archive Signed-off-by: Wojciech Prazuch <[email protected]>
Main's `_omit_unset_target` (#5978) and this branch's `_omit_unset_node_local` were both model_serializers on BenchmarkRunConfig. Pydantic keeps only one, so saved configs gained `target`, `agent` and `sandbox` set to None. One serializer now omits all four unset fields. Signed-off-by: Wojciech Prazuch <[email protected]>
What does this PR do?
Some benchmarks write thousands of small evidence files per run. On a shared parallel file system that is heavy metadata load. In plain
/tmpit is lost when the Slurm job ends.A benchmark can now set
node_localin itsgym eval submitconfig. The driver, and the serversgym eval runstarts, then getNEMO_GYM_NODE_LOCAL_DIR, a directory on the driver node's own disk. When the driver step ends, the job writes the files it added or changed there to<benchmark dir>/node-local/<SLURM_JOB_ID>.<SLURM_RESTART_COUNT>.tar.gz(renamed into place only when complete) and removes the directory.restore, on by default): before the services start, the job extracts every earlier archive of the run. The order is the job chain (.gym_job_chain), then archives the chain does not name, by job id, with each job's attempts in order. A later job's version of a file wins. Nothing is ever pruned. If the archives dir cannot be listed or an archive does not extract, the job stops before its services start. In a resumable run the next job then stops the chain withdriver_node_local_restore_failed, which names the archives and the way on. A chain job that left no archive gets a NOTE in the log. Leftover partial archives are removed. Withrestore: falseevery job starts empty.<base_dir>/gym-node-local-$SLURM_JOB_ID, mounted into the driver container at/tmp/gym-node-local/<gym job id>/<benchmark>. Every job of the run shares that path, so absolute paths a run saves stay valid after a restore.srunstep there. The archive is bounded (archive_timeout_seconds) and ignores TERM.archive_timeout_secondsplus 60 s). A TERM on the batch node (time limit, cancel, preemption) archives within the cluster'sKillWait. A requeued attempt drops its earlier attempt's markers first.node_local,model_call_capture_dirdefaults to<node-local dir>/model-callsinstead of<benchmark dir>/model-calls, so the per-call capture writes and claims stay on the driver's disk. They reach the benchmark dir in each job's archive. An explicitmodel_call_capture_dirstill wins.$NEMO_GYM_NODE_LOCAL_DIR/agentic_ifwhen the variable is set. The README's re-verify recipe extracts every archive in the same order.node_local.stop_before_walltime_seconds(default 420,0turns it off) adds#SBATCH --signal=B:USR1@<seconds>. OnUSR1the job stops the driver, archives once, stops the OpenTelemetry collector so its node files reach<benchmark dir>/otel/, and waits for the limit. The job still ends TIMEOUT, so the resume chain is unchanged. Withnode_local, the collector's node dir moves undernode_local.base_dir.node_localthe rendered script and the saved config are unchanged. Slurm only; other executors refuse it.Validation
tests/unit_tests/orchestration/test_node_local.py: config validation, placement, and the renderedjob.shrun with fakesrun. It covers restore order (chain, wrapped ids, judge-only archives, requeued attempts), archives that do not extract, a dir that cannot be listed, partial-file cleanup, per-job contents, a health-check failure, exports, a TERM before and during the archive, tar exit codes, and the archive timeout. It passes with BSD tar (macOS) and with GNU tar. It also covers theUSR1stop on and off the batch node, during a running archive, before the handler is armed, and with0.pytest tests/unit_tests/orchestration: no new failures againstmainon macOS.pre-commit run --files <changed files>passes.Rollouts
N/A: opt-in orchestration setting; rollout behavior is unchanged.
Compatibility and benchmark impact
None unless a benchmark sets
node_local. With it, the driver stops about 7 minutes before the time limit and the allocation idles until it. Raw model-call captures and agentic_if episodes reach the job dir only insidenode-local/*.tar.gz. A reader of<benchmark dir>/model-calls(for example an upload of the job dir) finds the archives instead. A node that fails before archiving loses that job's files; the rows keep their merged call summaries.Checklist
configuration.mdx).git commit -s).