Skip to content

feat(orchestration): add --resolve-only to gym eval submit - #3524

Merged
iguehring-nvidia merged 3 commits into
mainfrom
iguehring/eval-submit-resolve-only-signed
Sep 18, 2026
Merged

iguehring-nvidia merged 3 commits into
mainfrom
iguehring/eval-submit-resolve-only-signed

Conversation

@iguehring-nvidia

@iguehring-nvidia iguehring-nvidia commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds --resolve-only to gym eval submit: compose, resolve, and validate the submit config, print the resulting SubmitConfig, and stop — no job script is rendered, nothing is submitted, and no connection to compute.hostname is opened.

_eval_submit already builds exactly this object before calling submit(); the flag makes it observable. The YAML output is the same serialization BaseExecutor.persist() writes as resolved-config.yaml, so it diffs cleanly against a real run's persisted config. With --json it emits the config as JSON instead. --dry-run may be passed alongside it and is inert: both flags mean "do not submit" and --resolve-only stops earlier, matching how --json is already accepted and inert under --dry-run.

Why: downstream certification tooling (EFB Evergreen) needs to reproduce a leaf config's resolved form without submitting it. NEL and NEL Next expose that through their Python APIs (RunConfig.from_hydra, _load_config); Gym had no equivalent, and --dry-run does not serve — it prints rendered job.sh text and never reaches persist().

Part of #1640. No dedicated issue: a small additive flag on an existing experimental command. Design points open for discussion on this draft: flag on submit vs. a separate subcommand; YAML default with --json opt-in; inert vs. rejected --dry-run alongside it (inert chosen for consistency with --json under --dry-run).

Validation

Run against the final diff:

  • pytest tests/unit_tests/test_cli_eval_submit.py — 38 passed (31 existing + 7 new)
  • pytest tests/unit_tests/test_cli.py tests/unit_tests/test_cli_endpoint_readiness.py — 99 passed
  • ruff check / ruff format --check on both changed files — clean
  • pre-commit run --files nemo_gym/cli/main.py tests/unit_tests/test_cli_eval_submit.py — all hooks pass
  • Manual: gym eval submit --config <wrapper> --resolve-only against a real multi-fragment Hydra composition (an EFB gym-native leaf: cluster + model + benchmark fragments, hydra.searchpath overrides, ~cluster). Output is structurally identical to the resolved-config.yaml that a real submission of the same leaf persisted on the cluster; runtime:-prefixed env values are left unresolved as expected. --resolve-only --json parses as JSON.

New tests assert observable contracts: submit() is never called; stdout is byte-identical to what BaseExecutor.persist() writes (asserted against the real persist(), not a re-derivation of its serialization); Hydra overrides apply; --json emits JSON; an invalid config fails through the identical ConfigError path; through the real CLI (main() with argv) stdout parses whole and no executor is ever instantiated, with and without a redundant --dry-run.

Rollouts

N/A — CLI-only change. No environment, agent, model, or executor behavior changes; --resolve-only returns before any executor is instantiated.

Compatibility and benchmark impact

Additive; existing invocations are unchanged. --json now also applies to --resolve-only output (help text updated). No benchmark-result impact.

Docs: N/A — no Fern page documents gym eval submit flags beyond a release-notes bullet; --help is the reference and is updated by this change.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header. (No new files.)
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

🤖 Generated with Claude Code

`gym eval submit` already composes, resolves, and validates a SubmitConfig
before deciding whether to dry-run or submit, but a caller could not observe
that object without side effects: --dry-run renders executor scripts and
returns None, and only a real submission persists the resolved config
(BaseExecutor.persist -> resolved-config.yaml).

--resolve-only stops right after validation and prints the resolved config,
in the same YAML serialization persist() writes (or JSON with --json), so a
caller can obtain or diff the exact config a submission would run without
queueing a job or opening a connection to the cluster. It is registered in
a mutually exclusive group with --dry-run: the two stop at different depths
and combining them has no meaning.

Motivation: downstream certification tooling (EFB Evergreen) needs a
compose-only path to reproduce a certified hash from a leaf config. NEL and
NEL Next expose that through their Python APIs; Gym did not.

Part of #1640.

Signed-off-by: Ingo Guehring <[email protected]>
@iguehring-nvidia iguehring-nvidia added feature New capabilities, enhancements, or enablement work area:orchestration Job submission, deployment, services, and lifecycle management labels Sep 18, 2026
@copy-pr-bot

copy-pr-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

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.

Drop the mutually exclusive group. Both flags mean "do not submit" and
--resolve-only stops earlier, so the pair is redundant, not contradictory;
accepting it matches how --json is already accepted and inert under
--dry-run on this command. Removes the registration helper and keeps
--resolve-only a plain Flag like its neighbours.

Signed-off-by: Ingo Guehring <[email protected]>
@iguehring-nvidia
iguehring-nvidia added this pull request to the merge queue Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/35347263545

Merged via the queue into main with commit ef6cbc5 Sep 18, 2026
43 checks passed
@iguehring-nvidia
iguehring-nvidia deleted the iguehring/eval-submit-resolve-only-signed branch September 18, 2026 13:09
reinainblood pushed a commit to reinainblood/Gym that referenced this pull request Sep 21, 2026
…n record (NVIDIA-NeMo#3529)

## What does this PR do?

`gym-job.json` records `gym_version`, which repeats across every commit
between two version bumps. A reader that needs to reinstall the exact
Gym that wrote a record — to recompose the submission's config with `gym
eval submit --resolve-only` (NVIDIA-NeMo#3524) and compare it against what it
expects — cannot pin that from the version alone.

This adds `SubmissionRecord.gym_commit`: the commit of the nemo-gym that
wrote the record.

- A git install (`pip install git+…@<sha>`) records the commit in the
distribution's PEP 610 `direct_url.json` as `vcs_info.commit_id`; that
is used when present.
- Otherwise the checkout the running `nemo_gym` package is tracked in is
asked directly (`git ls-files --error-unmatch` on the package, then
`rev-parse HEAD` / `status --porcelain`): its HEAD when clean,
`<HEAD>-dirty` when it has uncommitted changes. This does not depend on
install metadata at all, so an editable install whose venv lacks
`nemo-gym` dist-info (uv can produce that) and a plain source tree on
`sys.path` both work.
- A package no checkout tracks — a wheel in `site-packages`, even when
the venv sits inside a clone — yields `None`; so does a missing `git`.
Every `None` is logged with its reason. An index wheel needs no commit
anyway: a published version is immutable, so `gym_version` already
identifies it.

Added with a default, as `jobs.py`'s compatibility rule requires of a
same-version change: records written before this still load under
`schema_version: 1`. `jobs.py` stays executor-agnostic (no new imports
from `executors/`).

Consumer: NVIDIA's eval-factory certification layer (Evergreen) pins the
Gym it recomposes with from this field instead of from its own toolchain
pin.

## Validation

```
.venv/bin/python -m pytest tests/unit_tests/test_orchestration_jobs.py tests/unit_tests/test_slurm_executor.py tests/unit_tests/test_cli_eval_submit.py
# 62 passed
pre-commit run --files nemo_gym/orchestration/jobs.py nemo_gym/orchestration/executors/slurm.py tests/unit_tests/test_orchestration_jobs.py
# all hooks pass
```

Against real installs: in a venv created with `pip install "nemo-gym @
git+https://github.com/NVIDIA-NeMo/gym.git@c41584d1…"`,
`direct_url.json` reads `{"vcs_info": {"commit_id": "c41584d1…"}}` and
the helper returns it; in this editable checkout with local edits it
returns `<HEAD>-dirty`, and the same source tree on `PYTHONPATH` in a
venv with no `nemo-gym` dist-info (where `distribution("nemo-gym")`
raises `PackageNotFoundError`) returns the same.

End to end on a Slurm cluster: `pip install "nemo-gym @
git+…gym.git@4636cd3…"` into a fresh venv, `gym eval submit` a real
config (job cancelled right after enqueue), `gym-job.json` reads
`"gym_commit": "4636cd35d33675551bfb6e3ba91295a1b03874fe"`.

Install scenarios exercised for real against this branch's head
(`29bf4f61`), beyond the unit tests:

| How nemo-gym is running | `direct_url.json` | `gym_commit` |
|---|---|---|
| `pip install "nemo-gym @ git+…@29bf4f61"` into a fresh venv on a Slurm
login node, real `gym eval submit` (job cancelled at enqueue) |
`vcs_info.commit_id` | `29bf4f61…` |
| `uv pip install -e <clean clone>` | `dir_info.editable` | `29bf4f61…`
|
| same editable venv, checkout with an uncommitted edit |
`dir_info.editable` | `29bf4f61…-dirty` |
| clean clone on `PYTHONPATH`, no nemo-gym dist-info at all
(`distribution()` raises) | — | `29bf4f61…` |
| same, checkout dirty | — | `29bf4f61…-dirty` |
| wheel built from the clone, installed into a `.venv` **inside** the
clone | `archive_info` | `None` (not tracked in a checkout) |
| clone on `PYTHONPATH`, `git` not on `PATH` | — | `None` (git is not
available) |

## Rollouts

N/A — orchestration metadata only; no environment or agent code.

## Compatibility and benchmark impact

Additive, defaulted field on `gym-job.json`; no schema version bump
needed and older records load unchanged. No benchmark-result effect.

## Checklist

- [x] I have read the [contributing
guidelines](https://github.com/NVIDIA-NeMo/Gym/blob/main/CONTRIBUTING.md).
- [x] The change is focused; unrelated "drive-by" edits are tracked as
separate issues/PRs.
- [x] Tests added or updated and pass locally, or N/A for docs-only /
non-code changes (so CI unit/server checks pass when applicable).
- [x] Documentation added or updated, or N/A with justification — the
field is documented in `SubmissionRecord`'s docstring, where the other
fields are.
- [x] Pre-commit checks pass locally (`pre-commit run --all-files`) (so
CI lint/format checks pass).
- [x] New source files include the required Apache-2.0 SPDX header — no
new files.
- [x] All commits have DCO sign-off (`git commit -s`) (so the DCO check
passes).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Ingo Guehring <[email protected]>

This branch was previously deployed

1 inactive deployment
public — c41584d1 Deployed Sep 18, 2026 by copy-pr-bot[bot] via release / finalize / notify #3152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:orchestration Job submission, deployment, services, and lifecycle management feature New capabilities, enhancements, or enablement work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants