Repository navigation
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. |
|
/ok to test 53e5997 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no concerns found.
I reviewed all changed files and traced the affected runtime paths, compatibility aliases, CLI status lookup, commit helper, and recovery-marker consumers. I found no qualifying regressions.
This was a static review. I couldn't run tests, build a wheel, or perform cluster smoke checks in this read-only environment.
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.
ananthsub
left a comment
There was a problem hiding this comment.
Requesting changes for one compatibility break and for the shape of the move, which is cheapest to settle before 0.8.0.
nemo_gym.orchestration.jobs.installed_gym_commit shipped in v0.7.0 and no longer imports, and the import-surface fixture was edited so the import-surface test no longer catches it. The inline comment on _moved_paths.py has the entry to add.
Server startup is only partly out of orchestration: cli/_locked_env.py and cli/_prepare_worker.py still sit in the orchestration layer, and server_venv runs _locked_env.py by file path from below it. Since none of the new paths has shipped, one top-level nemo_gym/supervisor/ package holding the server supervisor, the server virtual environment setup, the HTTP/2 ping sidecar and those two modules would settle the location once. The inline comments on server_runtime/__init__.py and pyproject.toml describe it.
The four commits are independent and have different reviewers and conflicts, so splitting them would let the uncontested parts land now:
installed_gym_commitand thegym eval statuslookup, as one small PR.- The server supervisor, server virtual environment and HTTP/2 ping sidecar move, after #5526 (the
RunHelper→ServerSupervisorrename), so that theRunHelperdeprecation entry points at the new location only once. #5553 rebases after it. - The
eval/recovery/markers.pycommit, moved into #5596, which creates the same files with a different docstring.
The branch also needs a rebase, because its base is 60 commits behind main. After the rebase, resources_servers/agentic_if_realworld (which imports installed_gym_commit from the old path) and test_benchmark_preparation.py (which imports DRIVER_FAILURE_ENV from resume_script) need their imports updated.
| ), | ||
| **_names("nemo_gym.eval.eval_plan", "0.8.0", "PlanBenchmark PlanGym build_eval_plan"), | ||
| **_names("nemo_gym.orchestration.jobs", "0.8.0", "installed_gym_commit"), | ||
| **_names("nemo_gym.utils.gym_commit", "0.8.0", "installed_gym_commit"), |
There was a problem hiding this comment.
Compatibility break: installed_gym_commit was public in nemo_gym.orchestration.jobs in v0.7.0 (jobs.py), and this PR removes it from that module without a deprecation path, so from nemo_gym.orchestration.jobs import installed_gym_commit now raises ImportError. The only new MOVED_NAMES entry for it is this one under nemo_gym.cli.eval, a path that never held the name in a release.
Code on main already imports the name from the released path: resources_servers/agentic_if_realworld does (core.py), and so does the open #5134, so both break once this lands. The PR description says nothing in orchestration was released, which holds for the server supervisor, the server virtual environment setup and the HTTP/2 ping sidecar, but jobs.py, submit.py, api.py, the executors and the Ray Serve gateway all shipped in v0.7.0.
Please add an entry under the released path, add __getattr__ = moved_names_getattr(__name__) at the end of orchestration/jobs.py, and keep installed_gym_commit in that module's entry of the import-surface fixture (dropping the private _git* helpers from it is fine):
"nemo_gym.orchestration.jobs": {
**_names("nemo_gym.utils.gym_commit", "0.8.0", "installed_gym_commit"),
},Why the import-surface test (`TestImportSurface`) did not catch the removal
The import-surface test compares each module against import_surface.json, which records each module's names from before any move, so a move without a MOVED_NAMES entry fails (test_moved_paths.py). This PR also removes installed_gym_commit from the fixture's nemo_gym.orchestration.jobs entry, so the test passes. With the base branch's fixture restored, the test fails on this name.
There was a problem hiding this comment.
Fixed in 8556d10. Entry under nemo_gym.orchestration.jobs, __getattr__ in jobs.py, name back in the fixture. You were right about my "nothing was released" line, it's corrected in the description.
| "nemo_gym.models", | ||
| # server_runtime/ (the supervisor on top, then what it starts servers with) | ||
| "nemo_gym.server_runtime.supervisor", | ||
| "nemo_gym.server_runtime.server_venv : nemo_gym.server_runtime.h2_ping_sidecar", |
There was a problem hiding this comment.
cli/_locked_env.py and cli/_prepare_worker.py are part of the code that starts servers, but they stay in the orchestration layer on line 889, seven layers above server_venv here. server_venv still runs _locked_env.py as a script that it finds by a file path into cli/ (server_venv.py), and import-linter cannot see a dependency on a file path. The contract therefore passes while every server virtual environment setup depends on a module in the layer this PR moves server startup out of.
environment/benchmark_preparation.py also imports both modules (line 94, line 136), so environment still depends on the orchestration layer as well. tests/unit_tests/test_orchestration_boundary.py misses both dependencies because it only matches nemo_gym.orchestration names.
Neither module imports anything from nemo_gym, so both can move without other changes. Please move them next to server_venv, have server_venv find _locked_env.py from its own package (Path(__file__).with_name(...)), and remove them from the orchestration layer on line 889. Because benchmarks/ruler/prepare_utils.py also imports nemo_gym.cli._locked_env, the old path needs a MOVED_MODULES entry.
There was a problem hiding this comment.
Done in cf8c0a8. Both moved into server_runtime/supervisor/. server_venv finds _locked_env.py with with_name, they're out of the orchestration layer, the old cli paths have MOVED_MODULES entries, and ruler uses sync_environment from the new public API. benchmark_preparation imports them from there too.
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| """What runs inside every Gym server: the resources and environment server bases, request handling, sessions, and partial-rollout checkpoints.""" | ||
| """What runs inside every Gym server: the resources and environment server bases, request handling, sessions, and partial-rollout checkpoints. Also the supervisor that starts the servers of a run and the venvs they run in.""" |
There was a problem hiding this comment.
The server supervisor, the server virtual environment setup and the HTTP/2 ping sidecar run only in the process that launches servers, never inside a server, yet this PR puts them in server_runtime. That changes what the package is: this docstring now has to add "Also the supervisor that starts the servers of a run and the venvs they run in", and _PUBLIC_API lists get_venv_path, run_command and setup_env_command next to the server base classes. A server author who reads nemo_gym.server_runtime then finds helpers for starting servers that no server uses.
The layer order in this PR already describes a separate package. The server supervisor imports only server_runtime, client, telemetry, core and config, and the two new layers sit directly above the rest of server_runtime.
Please make that a top-level nemo_gym/supervisor/ package directly above server_runtime, holding server_supervisor, server_venv, h2_ping_sidecar, tools/sidecar, _locked_env and _prepare_worker, and export get_venv_path, run_command and setup_env_command from it instead. Keeping the module name server_supervisor there avoids a clash with the agent sandbox's process supervisor, which the glossary already calls "the supervisor" (key-terminology.mdx). None of these paths has shipped yet, so this is the cheapest point to choose the final location, because after 0.8.0 each further move needs another _moved_paths.py entry.
There was a problem hiding this comment.
Went with your revised take: server_runtime/supervisor/ subpackage, not top-level (cf8c0a8). The server_runtime docstring is back as it was and the three names are out of its public API. supervisor has its own, and the layering puts it above the rest of server_runtime.
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| """The strings the auto-resume chain scripts and the commands they run use to leave a result for the next segment. |
There was a problem hiding this comment.
#5596 also creates this file and eval/recovery/__init__.py, with different content, and the two docstrings disagree on the dependency direction. This one says "the chain imports them from here", while the one in #5596 says "the planner never imports the chain" (markers.py in #5596).
Whichever PR lands second has to merge two modules with the same name and different contracts. #5596 also moves executors/slurm.py, which this commit edits, so the conflict reaches beyond these two files.
Please move this commit into #5596, which already owns eval/recovery and the nemo_gym.eval.recovery layer it adds to the import-linter contract, and until then keep the cli/utils.py → resume_script entry in KNOWN_VIOLATIONS.
| **_names("nemo_gym.orchestration.jobs", "0.8.0", "installed_gym_commit"), | ||
| **_names("nemo_gym.utils.gym_commit", "0.8.0", "installed_gym_commit"), | ||
| }, | ||
| "nemo_gym.server_runtime.h2_ping_sidecar.config": { |
There was a problem hiding this comment.
This entry is keyed under nemo_gym.server_runtime.h2_ping_sidecar.config, a module path that this PR creates, so the deprecation message names a path that no caller has ever used. A caller who imports H2_PING_SIDECAR_KEY_NAME from the released nemo_gym.h2_ping_sidecar.config gets three warnings, and the last one says that nemo_gym.server_runtime.h2_ping_sidecar.config.H2_PING_SIDECAR_KEY_NAME moved. scripts/migrate_imports.py follows the same entry, so it rewrites the import to the server_runtime module, which still warns, instead of to nemo_gym.config.global_config.
moved_names_getattr keeps entries under a module's old path and maps the new module back to it through MOVED_MODULES (_moved_paths.py). Please key the entry under the old path, so the same name is served with a message that names what the caller wrote:
| "nemo_gym.server_runtime.h2_ping_sidecar.config": { | |
| "nemo_gym.h2_ping_sidecar.config": { |
There was a problem hiding this comment.
Fixed in cc3848c. Keyed under nemo_gym.h2_ping_sidecar.config, so one warning pointing at global_config.
| target: str, | ||
| *, | ||
| json_output: bool = False, | ||
| job_artifact_dirs: Callable[[str], dict[str, Path] | None] | None = None, |
There was a problem hiding this comment.
With the None default, a caller that leaves this argument out gets "No batch_status.json or Gym job record found for " for a valid Gym job ID (line 1996), even though no job record was looked up. cli/main.py is the only caller and always passes it, so the default gains nothing.
Please make it a required keyword-only argument, so that a new caller cannot silently lose the Gym job ID lookup.
There was a problem hiding this comment.
Fixed in e894de4. Required keyword-only now.
| @@ -554,17 +554,17 @@ redirects: | |||
| destination: "/nemo/gym/:version/nemo-gym/nemo_gym/agents/testing/agent_session_conformance" | |||
| # Library reference pages of modules moved into nemo_gym/orchestration (#5166). | |||
There was a problem hiding this comment.
This comment still says the pages moved into nemo_gym/orchestration, but the destinations below now point at server_runtime. The library reference built from main also published pages under /nemo_gym/orchestration/server_supervisor, /orchestration/server_venv and /orchestration/h2_ping_sidecar, and this PR adds no redirects from them, so links to those pages stop resolving.
Please update the comment, and add the plain and :version redirects from those three orchestration paths to their new pages.
|
Revising one request from my review: the server supervisor does not need its own top-level package. The supervisor and the code that runs inside a server share one startup protocol (starting servers, health checks, the registry server, the runtime directory and Ray setup), and the registry server in What I would still change is the boundary inside the package:
Whether The rest of the review is unchanged, including the |
…rs in the new chain-guard test Signed-off-by: Tomasz Grzegorzek <[email protected]>
…stration.jobs It shipped in v0.7.0 under that path, so the old import now resolves to nemo_gym.utils.gym_commit with a deprecation warning, and the import-surface fixture lists the name again. Signed-off-by: Tomasz Grzegorzek <[email protected]>
… path A caller of the released nemo_gym.h2_ping_sidecar.config now gets one warning that names nemo_gym.config.global_config, and scripts/migrate_imports.py rewrites to it. Signed-off-by: Tomasz Grzegorzek <[email protected]>
cli/main.py is the only caller; a default would let a new caller silently lose the Gym job ID lookup. Signed-off-by: Tomasz Grzegorzek <[email protected]>
The server supervisor, server venv and sidecar pages published from main under nemo_gym/orchestration now redirect to their server_runtime pages (plain and :version), and the section comment names server_runtime. Signed-off-by: Tomasz Grzegorzek <[email protected]>
…/recovery/markers This belongs in the recovery relocation (#5596), which creates eval/recovery and owns its contract. The cli/utils.py -> resume_script import returns to KNOWN_VIOLATIONS until then. When this branch is merged into #5596, those two commits must be re-applied there. Signed-off-by: Tomasz Grzegorzek <[email protected]>
…me/supervisor/ The server supervisor, server venv, HTTP/2 ping sidecar (with its Go sources) and the two scripts the venv runs (_locked_env, _prepare_worker, moved from cli/) become one subpackage, so server_venv finds _locked_env.py beside itself and nothing runs it by a path into cli/. - The subpackage has its own public API (get_venv_path, run_command, setup_env_command, sync_environment); nemo_gym.server_runtime exports none of them and its docstring is back to what runs inside a server. - The layering contract puts server_runtime.supervisor above the rest of server_runtime, so nothing that runs inside a server can import it, and drops _locked_env/_prepare_worker from the orchestration layer. - Old nemo_gym.cli._locked_env and _prepare_worker paths get MOVED_MODULES entries; the docs redirects, the tests (now under tests/unit_tests/server_runtime/supervisor/) and the CI durations keys follow. Signed-off-by: Tomasz Grzegorzek <[email protected]>
e85aae2 to
e4867f1
Compare
…isor.py The supervisor module is server_runtime/supervisor/server_supervisor.py; the test, which the telemetry extra gates, still expected supervisor.py. Signed-off-by: Tomasz Grzegorzek <[email protected]>
| - source: "/nemo/gym/:version/nemo-gym/nemo_gym/testing/agent_session_conformance" | ||
| destination: "/nemo/gym/:version/nemo-gym/nemo_gym/agents/testing/agent_session_conformance" | ||
| # Library reference pages of modules moved into nemo_gym/orchestration (#5166). | ||
| # Library reference pages of modules moved into nemo_gym/server_runtime (#5166). |
There was a problem hiding this comment.
| # Library reference pages of modules moved into nemo_gym/server_runtime (#5166). | |
| # Library reference pages of modules moved into nemo_gym/server_runtime (#5882). |
All threads were addressed. Main moves too quick to keep this fix. Happy to do any required follow-ups
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42832788487 |
Summary
Stacked on #5749. Moves code that doesn't belong in
nemo_gym.orchestrationout of it (rows 1 to 5 of #5749's table) and drops the matchingKNOWN_VIOLATIONSentries. The failure-kind writer and the recovery planner go with #5596. No issue: code moves only.server_supervisor,server_venv, the H2 ping sidecar and its Go sources, pluscli/_locked_env.pyandcli/_prepare_worker.py) now lives innemo_gym/server_runtime/supervisor/. It has its own public API (get_venv_path,run_command,setup_env_command,sync_environment), whichnemo_gym.server_runtimeno longer exports. The layering contract puts it above the rest ofserver_runtime, so nothing inside a server can import it.installed_gym_commitmoved toutils/gym_commit.py.gym eval statustakes its job-ID lookup as a required keyword;cli/main.pypasses it, socli/eval.pyno longer imports orchestration."sidecar"key-name constant now lives inconfig/global_config.py.KNOWN_VIOLATIONSis down to 12: the 11orchestration.recoveryimporters (#5596) andcli/utils.py→resume_script(the failure-kind move, reverted here and left to #5596).Compatibility
orchestration.jobs.installed_gym_commitshipped in v0.7.0, so it still imports from there (same object, warns). Everything else moved here did not ship under orchestration._moved_paths.pypoint at the new locations, includingnemo_gym.cli._locked_envand_prepare_worker.H2_PING_SIDECAR_KEY_NAMEis served from the releasednemo_gym.h2_ping_sidecar.config.fern/docs.ymlredirects the old orchestration library pages.#5596
It moves
executors/slurm.pyandresume_script.py, which this PR also touches. Its branch has the failure-kind commits this PR reverted, so re-apply them there after merging this branch in.Validation
Rollout evidence: N/A, code moves only.