Repository navigation
fix(otel): run the collector and its file exports from node-local /tmp - #6215
Conversation
The collector step copies otel.binary into a private node-local directory (mktemp under /tmp, named after the Slurm job id), runs the copy, and points the three file exporters there. When the collector exits, the same step appends each jsonl to <job dir>/otel/ and removes the node-local directory, so shared storage sees one sequential write per file per job instead of an append per batch. The shutdown pkill matches the node-local copy and, when the collector runs beside a driver that is not on the batch host, runs on that node. Resubmit keeps the in-job-dir exporter paths for a job.sh that predates the copy step. 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 refused repin can restore an older job script while leaving its collector configuration on incompatible node-local exporter paths.
I inspected all nine changed files and traced startup, shutdown, and resubmit compatibility. One parallel report was unavailable, so I completed its collector-wrapper inspection myself. This was static review; I did not execute tests or validate Slurm runtime behavior.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| return f"printf %s {shlex.quote(collector_yaml)} > {collector_path} || fail 'cannot update collector config'" | ||
|
|
||
| # An older job.sh never copies node-local jsonl into the job dir, so its collector writes there. | ||
| collector_update = [ |
There was a problem hiding this comment.
RISK: roll back the collector configuration with the job script.
By source inspection, an OTel-enabled run with a pre-wrapper job.sh becomes internally incompatible after a refused repin to this revision. repin_commands installs the new script before this marker check, so this branch writes ${env:GYM_OTEL_LOCAL_DIR}/*.jsonl. If sbatch refuses the request, the exit trap restores only the script and resolved configuration. The restored script never exports that variable or copies files out. Queuing that restored script directly therefore cannot deliver telemetry to its promised job-directory paths, despite the refusal reporting job_dir_restored: true. Before this change, the exporter paths did not depend on the script version.
Could _rerender_commands back up and restore the collector configuration in the same transaction? The invariant is that a refused rerender restores a compatible script/configuration pair. After constructing restore, this insertion provides the missing backup:
collector_backup = []
if otel_active(config):
collector = shlex.quote(str(collector_config_path(job_dir)))
kept_collector = shlex.quote(
f"{collector_config_path(job_dir)}.pre-{kinds[0]}-{stamp}"
)
collector_backup = [
f"cp -p {collector} {kept_collector} || fail 'cannot keep collector config before rendering'"
]
restore += f"; mv -f {kept_collector} {collector} 2>/dev/null"Expand *collector_backup into commands before installing _gym_restore_repin. Please verify this suggestion before adopting it. Keep successful rerenders on node-local paths, ordinary legacy resubmits on job-directory paths, and active-run refusal before any collector update. Token fallback must still apply to successfully queued attempts.
Proposed acceptance checks, not executed: extend the repin refusal test with OTel enabled, a pre-wrapper script and direct exporter paths. Force the existing deterministic scheduler refusal and assert byte-for-byte restoration of the script, resolved configuration and collector configuration. With submission accepted, assert that the new script exports GYM_OTEL_LOCAL_DIR and all three exporters reference it. Retain the legacy/new-script path assertions and the active-run unchanged-config assertion.
…nder A refused repin or walltime rerender restored job.sh and the resolved config but kept the collector config the resubmit had rewritten for node-local paths, so the restored older job.sh would start a collector writing to an unset GYM_OTEL_LOCAL_DIR. Back the collector config up with the script and restore it in the same exit trap. Also note on the collector docs page how large the node-local jsonl can grow, so node /tmp is sized for it. Signed-off-by: Wojciech Prazuch <[email protected]>
…config A run staged with OTel off has no otel/collector.yaml, but its saved config can still enable the collector, so the rerender's unconditional backup aborted a repin that worked before. Back the file up only when it exists; on a refused rerender move the backup back, or remove the collector config the resubmit wrote when there was none. Signed-off-by: Wojciech Prazuch <[email protected]>
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/43904642177 |
Ports main's changes to the files this PR moved: - orchestration/recovery.py (#6210, #6080, #6223): 3 symbols changed and 6 added, into the eval/recovery modules; NO_ELIGIBLE_RETRY_REASON moves to eval/recovery/markers.py because the evidence reader now uses it. - executors/slurm.py (#6210, #6223, #6215): the 12 hunks, into executors/slurm/chain.py, judge_job.py and reader.py. - tests that import the old module paths (the otel, resubmit and recovery tests added since). Signed-off-by: Tomasz Grzegorzek <[email protected]>
What does this PR do?
The OTel collector ran straight from
otel.binary, often a path on shared storage, and its file exporters appendedmetrics.jsonl,traces.jsonlandlogs.jsonlinto<job dir>/otel/for the whole run, one span per traced vLLM request. Executing code and streaming small appends on a shared parallel file system both load it for the whole job.otel.binaryinto a private node-local dir (mktemp -d /tmp/gym-otel-<slurm job id>.XXXXXX) and runs the copy.file/*exporters write to that dir. When the collector exits, its step appends each jsonl to<job dir>/otel/and removes the dir.pkillmatches the node-local copy. When the collector runs beside a driver that is not on the batch host, thepkillruns on that node throughsrun. Before, it missed there and the step was killed without a flush.resubmitkeeps the old in-job-dir exporter paths for ajob.shthat predates the copy step, and a refused rerender restores the collector config together withjob.sh.The files are appended, not written per job: the names and layout stay what readers already see, and the exporter already appended across resume segments. The copy runs in the collector's own step because that step may be on another node or in a container, so it is the only place that sees its own
/tmp.Validation
pkillpattern (expanded by bash, then matched against the copy,srunand the wrapper), the remote-node stop, and the resubmit config choice.pytest tests/unit_tests/orchestration: 3171 passed; the 54 failures fail identically onmainon this macOS machine (BSD tool differences).pre-commit run --files <changed files>passes.Rollouts
N/A: telemetry plumbing only.
Compatibility and benchmark impact
None for results.
otel/*.jsonlnow fill in when the collector stops instead of during the run; remote OTLP export is unchanged. Needs room for the jsonl in node/tmp.Checklist
eval-submit-collector.mdx).git commit -s).