Skip to content

fix(opensandbox): let a caller launch the cleanup job from anywhere - #2791

Merged
bxyu-nvidia merged 9 commits into
mainfrom
plaszkiewicz/opensandbox-cleanup-paths
Aug 26, 2026
Merged

fix(opensandbox): let a caller launch the cleanup job from anywhere#2791
bxyu-nvidia merged 9 commits into
mainfrom
plaszkiewicz/opensandbox-cleanup-paths

Conversation

@laszkiewiczp

Copy link
Copy Markdown
Contributor

Problem

benchmarks/nemotron_3.5_super/sbatch_external_vllm.sh locates the run-scoped cleanup job's script under submit_dir=$(pwd -P), which assumes the launcher is invoked from a Gym checkout. A caller that launches from a scheduler run directory has no such tree there, so the submission fails outright:

sbatch: error: Unable to open file <rundir>/nemo_gym/sandbox/providers/opensandbox/cleanup_sandboxes.py
Failed to submit cleanup job for batch job 6540264; the batch job is still active

No cleanup job is scheduled and sandboxes are never reaped. This is how NVIDIA's eval-factory benchmarking runner drives the launcher: it stages a copy of the script into a per-run directory and cds there, because that is where slurm-logs/ and results/ live.

Changes

  1. NEMO_GYM_REPO_ROOT names the checkout, alongside the launcher's other declared inputs at the top of the file. It defaults to the working directory, so a launch from a checkout is unchanged.
  2. The connection comes from OPENSANDBOX_DOMAIN and OPENSANDBOX_API_KEY — the same two variables the run itself resolves opensandbox.yaml from. The launcher no longer looks for an env.yaml and no longer forwards --connection-config; the flag stays on the script for a manual run.
  3. A failed cleanup submission no longer strands the main job. It printed no job ID and exited 1, so a caller read a live 4-node job as a failed submission — and resubmitted it. It now prints Submitted batch job <id>, warns that its sandboxes need reaping by hand, and exits 0.

Dropping the env.yaml route is deliberate: that file is merged over every config a run names, so a connection read from it can silently override the evaluated config, and no hash covers it.

Testing

pytest tests/unit_tests/test_opensandbox_cleanup.py — 40 passed, 3 skipped. ruff check and ruff format --check clean on both changed files.

Supersedes

Replaces #2788, rebased onto current main and squashed. Same change, opened from a branch whose commits carry a sign-off.

The launcher locates the run-scoped cleanup job's script under the working
directory, which assumes it was invoked from a Gym checkout. A caller that
launches from a scheduler run directory has no such tree there, so the
submission fails and no cleanup job is scheduled.

NEMO_GYM_REPO_ROOT names the checkout and joins the other declared inputs at
the top of the launcher. The connection comes from OPENSANDBOX_DOMAIN and
OPENSANDBOX_API_KEY, the same two variables the run resolves opensandbox.yaml
from, so the launcher no longer reads an env.yaml or forwards
--connection-config; the flag stays for a manual run.

A failed cleanup submission no longer strands the main job: it printed no job
ID and exited 1, so a caller read a live 4-node job as a failed submission and
resubmitted it.

Signed-off-by: Piotr Laszkiewicz <plaszkiewicz@nvidia.com>
Co-authored-by: Grzegorz Chlebus <gchlebus@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@laszkiewiczp

Copy link
Copy Markdown
Contributor Author

/ok to test b0d6431

Signed-off-by: plaszkiewicz <plaszkiewicz@nvidia.com>
… are read"

This reverts commit 3a1726c.

Signed-off-by: plaszkiewicz <plaszkiewicz@nvidia.com>
@laszkiewiczp

Copy link
Copy Markdown
Contributor Author

/ok to test 6dbd525

A caller that exports SBATCH_GPUS_PER_NODE for the main job has the cleanup
job inherit it, so a one-CPU job asks four GPUs of a partition that has none
and sbatch refuses it. --gres=none does not override that variable.

Signed-off-by: plaszkiewicz <plaszkiewicz@nvidia.com>
@laszkiewiczp

Copy link
Copy Markdown
Contributor Author

/ok to test a9dc9a0

Review: no environment variables in Gym. The cleanup script now takes
--domain, --api-key and --protocol; --connection-config stays as the
alternative and the two cannot be combined. The environment fallback is gone.

The launcher no longer reads NEMO_GYM_REPO_ROOT either: it resolves the
checkout from its own location, so a caller launching from a run directory
needs to set nothing. Its own $@ is forwarded to gym eval, so the checkout
could not become a flag on the launcher.

Signed-off-by: plaszkiewicz <plaszkiewicz@nvidia.com>
@laszkiewiczp

Copy link
Copy Markdown
Contributor Author

/ok to test 29450b8

Comment thread benchmarks/nemotron_3.5_super/sbatch_external_vllm.sh
Review follow-up. OPENSANDBOX_DOMAIN present means the caller exports the
connection, so it goes to the cleanup script as --domain/--api-key/--protocol;
otherwise the checkout's own env.yaml is read, as it was before. The branch is
built as an array, so neither form depends on word splitting.

Signed-off-by: plaszkiewicz <plaszkiewicz@nvidia.com>
A caller that runs a copy of this script cannot resolve the tree it came from,
so it names it. Consumed before the rest is handed to gym eval, and it still
defaults to the script's own tree, so a launch from a checkout is unchanged.

Signed-off-by: plaszkiewicz <plaszkiewicz@nvidia.com>
@bxyu-nvidia

Copy link
Copy Markdown
Contributor

/ok to test b1f741b

@laszkiewiczp

Copy link
Copy Markdown
Contributor Author

/ok to test 45c8547

1 similar comment
@laszkiewiczp

Copy link
Copy Markdown
Contributor Author

/ok to test 45c8547

@bxyu-nvidia
bxyu-nvidia disabled auto-merge August 26, 2026 16:36
@bxyu-nvidia
bxyu-nvidia merged commit bb923fe into main Aug 26, 2026
36 checks passed
@bxyu-nvidia
bxyu-nvidia deleted the plaszkiewicz/opensandbox-cleanup-paths branch August 26, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants