Repository navigation
Conversation
…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]>
…e 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]>
Signed-off-by: Wojciech Prazuch <[email protected]>
Signed-off-by: Wojciech Prazuch <[email protected]>
…ed 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]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
I found one RISK: a USR1 during collector launch can bypass its early shutdown, leaving telemetry copy-out dependent on KillWait again.
I inspected all seven changed files and traced the affected driver, archive, collector, and resume paths. This was a static review; I did not execute tests or verify signal delivery on a Slurm cluster.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| {pid_var}="" | ||
| _gym_collector_stopped="" | ||
| {command}() {{ | ||
| [[ -z "$_gym_collector_stopped" && -n "${pid_var}" ]] || return 0 |
There was a problem hiding this comment.
RISK: Defer USR1 across the collector launch and PID capture.
If USR1 arrives between the collector's background srun and OTEL_COLLECTOR_PID=$!, this guard returns because the PID is still empty. Those are separate generated commands. The stop handler sees no driver, archives, and enters its indefinite walltime wait, so execution never reaches the PID assignment. The already-launched collector misses the early stop and append; its files again depend on shutdown fitting within KillWait. This affects early signals during collector startup on either placement, with host or container execution.
Could you guard the collector launch using the existing LAUNCH_GUARD? Keep the empty-PID return for a collector that genuinely has not started. The invariant is that the stop handler cannot run between starting the collector and recording its PID.
Suggested change in _render_collector_service: add the keyword-only argument launch_guard: tuple[str, str] | None = None, assign its current _render_service_command(...) result to service, and replace the return with:
if launch_guard is None:
return service
before, after = launch_guard
return f"{before}\n{service}\n{after}"At the builder call, pass:
launch_guard=node_local_script.LAUNCH_GUARD if stops_early else None,This records a pending signal until the PID is known, then lets the existing handler stop the collector before waiting. Scripts without early stopping stay unchanged. Please verify the suggested code before adopting it.
Proposed acceptance checks, not executed: render a job with the existing fake collector and inject a wait for its ready file followed by kill -USR1 $$ immediately before the collector PID assignment. For batch-node and off-batch placement, assert that the driver never starts, shared traces.jsonl contains start\nflushed\n, the collector directory is removed, and the batch shell keeps waiting for the time limit. Retain the existing assertions that driver-time USR1 appends after earlier segment and that a signal during restore starts neither services nor driver. Also check that stop_before_walltime_seconds: 0 still renders no USR1 handling.
There was a problem hiding this comment.
Fixed. The collector launch is wrapped in the same guard as the driver. test_a_usr1_between_the_collector_launch_and_its_pid_still_stops_the_collector fails without it.
Signed-off-by: Wojciech Prazuch <[email protected]> # Conflicts: # nemo_gym/orchestration/executors/node_local.py
…ts 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]>
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]>
Signed-off-by: Wojciech Prazuch <[email protected]> # Conflicts: # nemo_gym/orchestration/executors/node_local.py
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
I verified that the prior collector-launch race is fixed. The collector launch guard now defers USR1 until the collector PID is recorded. The new regression test injects the signal at that boundary and asserts that the driver never starts and telemetry flushes before walltime, for both placements.
I compared the fix and subsequent lifecycle, relocation, and test changes against the previous reviewed head. I found no unresolved prior findings or new regressions above the existing moderate-impact ceiling. This was a static follow-up review; I did not execute tests or validate signal delivery on Slurm.
Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.
…-local-walltime-stop Signed-off-by: Wojciech Prazuch <[email protected]>
0ddac6a
into
wprazuch/segment-node-local-archive
What does this PR do?
Stacked on #6217 (node-local driver dir, archived per Slurm job); review that first. A reviewer of #6217 asked for the stop before the time limit as its own PR, triggered by Slurm's
--signal, and for the same stop to shut down the OpenTelemetry collector.A step at its time limit is killed within moments, and a step off the batch node cannot start then, so the node-local dir may not be archived. With
node_local, the job now stops before the limit:node_local.stop_before_walltime_seconds(default 420;0turns it off) adds#SBATCH --signal=B:USR1@<seconds>.USR1the batch shell stops the driver (TERM, up to 60 s), archives with the existing per-job step, stops the collector so it appends its node files to<benchmark dir>/otel/, removes the dir, and waits for the limit. The job still ends TIMEOUT, so the auto-resume chain is unchanged.srunsteps on the driver's node.USR1before the handler is armed is acted on once it is.archive_timeout_seconds + 60 + 140 + 60 + 30(driver exit, collector shutdown, signal slack, margin), 410 at the defaults.node_local, the collector's node dir moves undernode_local.base_dir, so one setting places all of a job's node-local files.Validation
tests/unit_tests/orchestration/test_node_local.py: the renderedjob.shwith fakesrun, receivingUSR1: the stop on and off the batch node,USR1during a running archive, before the handler is armed, a requeued attempt,0, and the validator. Passes under-n 8.pytest tests/unit_tests/orchestration: no new failures against feat(orchestration): node-local driver directory, archived into the job dir once per Slurm job #6217 on macOS.pre-commit run --files <changed files>and the secret scan pass.Rollouts
N/A: only the batch script's lifecycle near the time limit changes.
Compatibility and benchmark impact
Only benchmarks with
node_local: their jobs stop the driver about 7 minutes before the limit and hold the allocation idle until it.stop_before_walltime_seconds: 0keeps #6217's behavior. Scripts withoutnode_localrender as before.Checklist
configuration.mdx,eval-submit-collector.mdx).git commit -s).