Repository navigation
Conversation
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM. No concerns found.
I reviewed all 18 changed files and traced the affected routing through preprocessing, dispatch and aggregation. The extracted helpers keep the existing routing behavior. I found no regression in the public exports or legacy import compatibility.
Static review only. I did not execute tests or verify the validation reported in the PR.
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.
athitten
left a comment
There was a problem hiding this comment.
Approving. I checked that behavior is unchanged: the two moved functions are identical to the originals, and the old and new routing code return the same server or raise the same error in 220 config and row cases. The PR's tests pass at this commit and merged with current main, as do the gdpval, long_transduction and harness_conformance tests it touches. Each routed row costs about 50 ns more. The five failing conformance checks also fail on main or on other PRs today. The comments below are non-blocking.
optional Heads-up on open PRs that use the old names. #6040 merges cleanly but then calls _environment_servers_by_agent in test_environment_scaffold.py, which this PR no longer imports there (ruff F821). #6037 and #5538 add the same call to files whose imports this PR rewrites. #5983, #5984 and #5010 import the private names from rollout_collection, and #5386 and #3819 call them inside it. Those keep working through the aliases, but could move to the new public names.
…_config environment_server_for_row, environment_servers_by_agent and environment_server_for_agent decide which environment server receives a row. They lived in rollout_collection, where data tooling cannot import them, because nemo_gym.data sits below nemo_gym.rollouts. They now live in nemo_gym.config.global_config, so collation can route rows with the same rules. environment_server_for_row takes the row's taskset instead of the row, because nemo_gym.config cannot import nemo_gym.core. Behavior does not change. The old private names stay importable from rollout_collection, and _moved_paths records the two exception classes it no longer imports. Signed-off-by: Ananth Subramaniam <[email protected]>
78b0d96 to
661151e
Compare
marta-sd
left a comment
There was a problem hiding this comment.
approving with one nit comment
| return routes[taskset] | ||
| except KeyError as error: | ||
| raise ValueError(f"No environment server route is configured for taskset {taskset!r}") from error | ||
| if routing_mode == "agent": |
There was a problem hiding this comment.
nit, non-blocking: it would be nice to have routing modes extracted as contants / enums
Before and after
Before: the rules that pick the environment server for a row live in
nemo_gym/rollouts/rollout_collection.py. Data tooling sits belownemo_gym.rolloutsin the import layers, so collation cannot use them and would have to copy them.After: the rules live in
nemo_gym/config/global_config.py, and rollout collection calls them from there. Collation can route rows with the same functions (#6449).flowchart LR OLD["Before: rollout_collection.py holds the routing rules"] -->|"moved, behavior unchanged"| NEW["After: global_config.py holds environment_servers_by_agent, environment_server_for_agent, environment_server_for_row"] NEW --> RC["rollout collection"] NEW --> COL["collation, in a later PR"] classDef bad fill:#fde2e1,stroke:#c0392b,color:#000 classDef good fill:#dff5e3,stroke:#1e8449,color:#000 class OLD bad class NEW goodWhat changed and why
environment_servers_by_agentandenvironment_server_for_agentmove tonemo_gym.config.global_configunchanged, as public functions.environment_server_for_rowholds the routing rule that_environment_server_for_config_rowapplied: a task row routes by its taskset'senvironment_server_routesentry, and a flat row followsenvironment_routing_mode. It takes the row's taskset instead of the row, becausenemo_gym.configcannot importnemo_gym.core, which defines what a task row is._environment_server_for_config_rownow computes the taskset and calls it.environment_server_for_rowrefuses a flat row underenvironment_routing_mode: legacywithoutenvironment_server_name, and under an unknown mode such asLegacy. Rollout collection's config validation already refuses both configs before any row routes. Collation in fix(data): check collated rows against the server that receives them #6449 passes raw config values, so without this guard it would check such rows asagentmode does, or report a taskset-routing error._moved_paths.pyrecords the old private names_environment_servers_by_agentand_environment_server_for_agent, and the two exception classesrollout_collectionno longer imports. Old imports throughrollout_collectionresolve to the same objects with aDeprecationWarning, andscripts/migrate_imports.pycan rewrite them.benchmarks/gdpval,resources_servers/gdpval,resources_servers/long_transduction,responses_api_agents/hermes_agent,scripts/harness_conformanceand the unit tests import fromglobal_config.Rollout collection behaves as before.
Issue
None filed. A preparatory refactor for #6449, so collation and rollout collection route rows with one implementation.
Validation
The existing routing tests, now calling the moved functions, cover the behavior. New tests check that a task row routes by its taskset in every mode, that a flat row follows the mode, and that a flat row under
legacywithout a server name or under an unknown mode is refused. The moved-paths test checks that every old name still resolves.Rollout evidence
N/A. A refactor; rollout collection's behavior does not change, and the new refusals cover configs it already rejects.
Compatibility
Old imports keep working through
_moved_paths.py, with aDeprecationWarningand removal in 0.10.0. Open PRs that call_environment_servers_by_agentinsiderollout_collection.pyneed the new name when they rebase.