Repository navigation
refactor(orchestration): split the server supervisor out of cli/env.py - #5235
Conversation
|
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. |
d4cd8e8 to
04f2d02
Compare
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no concerns found.
Reviewed all 10 changed files and directly affected callers, compatibility contracts, lifecycle/readiness paths, and tests. The extraction into server_supervisor.py preserves the inspected behavior, with the RunHelper re-export and moved-name compatibility consistent with existing contracts.
Static review only; tests were not executed.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
04f2d02 to
25cbb9e
Compare
25cbb9e to
3dadf80
Compare
70c84a3 to
012d5d8
Compare
012d5d8 to
3eeaec9
Compare
3eeaec9 to
f7e0053
Compare
f7e0053 to
0ba91c4
Compare
0ba91c4 to
6c562c3
Compare
cli/env.py keeps the `gym env` commands. RunHelper, which starts, watches and stops a run's servers, moves unchanged to orchestration/server_supervisor.py with the endpoint probes, timeouts and launch helpers it uses. cli/env.py imports RunHelper back, so `nemo_gym.cli.RunHelper` and `nemo_gym.cli.env.RunHelper`, which NeMo RL uses, stay the same object without a warning. Record the split names in MOVED_NAMES, serve them from cli/env.py through __getattr__, rewrite in-repo references with scripts/migrate_imports.py, and point test patches and attribute reads at the module that now looks each name up; names both modules use are patched on both. Regenerate the public API of each layout package that exists here from what non-test code outside nemo_gym imports, and point code outside nemo_gym, tests included, at nemo_gym.<package>. Signed-off-by: Ananth Subramaniam <[email protected]>
What and why
Splits the server supervisor out of
cli/env.py.RunHelper, which starts, watches, and stops a run's servers forgym env startandgym eval run, is orchestration, not a CLI command; it moves toorchestration/server_supervisor.pywith the endpoint probes, timeouts, and launch helpers it uses.cli/env.pykeeps thegym envcommands.Where this PR sits
The stack lands bottom-up; each PR's base is the branch of the PR before it, so each diff shows only that PR's change.
What moves
flowchart LR subgraph E["cli/env.py today"] C["gym env commands:<br/>status, test, init, list, ..."] R["RunHelper, endpoint probes,<br/>spin-up timeouts, launch helpers"] end C --> C2["cli/env.py"] R --> R2["orchestration/server_supervisor.py"] C2 -->|"imports RunHelper"| R2 classDef this fill:#fde68a,stroke:#b45309,stroke-width:2px,color:#1f2937 class R2 thisWhat stays importable from the old paths
cli/env.pyimportsRunHelperback, sonemo_gym.cli.RunHelperandnemo_gym.cli.env.RunHelper, which NeMo RL imports and patches, stay the same object without a new warning.nemo_gym.cli.envwith one warning, through a__getattr__.nemo_gym.cli.envof a nameRunHelpernow looks up inserver_supervisorhas no effect. In this repo, test patches and reads target the module that looks each name up; names both modules use are patched on both.How to review
One commit: the split, the
MOVED_NAMESentries, rewritten references, and the retargeted test patches.History of split files
The repository squash-merges, so this PR lands as one commit. Whole-module moves still show as renames. A split file does not: its old path stays with less in it, so the new file starts its own history.
git blame -C -C <new file>follows the moved lines back to the old file, andgit log --followdoes not.Public API
Every layout package that exists after this PR has a lazy public API in its
__init__.py: the names code outsidenemo_gym/imports from it (servers and their tests, benchmarks, scripts, and code samples in docs and skills), plus every name it already exported, each served from the submodule that defines it on first use. Code outsidenemo_gym/and its tests (servers and their tests, benchmarks, scripts, and docs) imports those names fromnemo_gym.<package>, so later moves inside a package leave it alone. Code insidenemo_gym/, and the library's tests undertests/, import from the module that defines each name, so the import-linter contract sees every dependency and a test reads what it patches. A patch target names the module the code under test looks the name up in.AGENTS.mdstates the rule.Validation
pytest -n 16 tests/unit_tests, also with-W errorfor the moved names. The only failures are environment-specific and unrelated to the move, as in the other PRs.lint-imports;pre-commit runon the changed files.Rollout evidence: N/A. The code moves unchanged;
gym env startbehaves as before.Compatibility
RunHelperresolves without a warning as before.python scripts/migrate_imports.py <paths>.Issue
Part of #5166.