Repository navigation
refactor(rollouts): move environment server routing helpers to global_config - #6446
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. |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
I found no blocking correctness issues. The routing branches match the base behavior, and the old helper aliases and exception imports still resolve. One non-blocking API-maintenance NOTE is inline.
I reviewed all 17 changed files and traced the affected preprocessing, dispatch, aggregation, and import-compatibility paths. I did not execute tests in this read-only review.
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.
| TASK_INDEX_KEY_NAME, | ||
| TASK_SOURCE_KEY_NAME, | ||
| ) | ||
| from nemo_gym.config.global_config import environment_server_for_agent, environment_servers_by_agent |
There was a problem hiding this comment.
NOTE · suggestion: export the externally used routing helpers through the config API
These helpers now have public names and external callers, but neither appears in the config package's public API. By source inspection, from nemo_gym.config import environment_server_for_agent, environment_servers_by_agent cannot resolve them, while this deep import works. This is an API-maintenance gap, not a runtime routing regression: external callers should use the package API without depending on the implementation module.
Could you add these entries to the config initializer?
ModelCallSamplingConfig,
+ environment_server_for_agent,
+ environment_servers_by_agent,
find_open_port,And add the matching _PUBLIC_API entries:
"TOKEN_CAPTURE_PATH_SEGMENT": "config_types",
+ "environment_server_for_agent": "global_config",
+ "environment_servers_by_agent": "global_config",
"find_open_port": "global_config",Then replace this import with from nemo_gym.config import environment_server_for_agent, environment_servers_by_agent, and make the same replacement in the changed NOOA recipe test, long-transduction test, Hermes recipe test, and conformance test. Both changes are needed because the existing external-import check rejects deep imports once a name is exported.
Keep library code and core tests importing the defining module. Keep the helper implementations, private rollout aliases, and exception shims unchanged.
Acceptance, not executed here: package imports should return the identical objects defined by global_config; the existing facade tests should retain their identity, lazy-loading, and matching type-checking declarations. The external-import check should find none of these five deep imports, and old private aliases should still resolve to the same functions through both rollout module paths. Verify the suggested patch before adopting it.
There was a problem hiding this comment.
Done in a1c0e0a: environment_server_for_agent and environment_servers_by_agent are exported from nemo_gym.config, and the five callers outside the library import them from there. Library code keeps importing global_config, and the rollout aliases and exception shims are unchanged.
1435e14 to
f9cf1bf
Compare
4954c57 to
a1c0e0a
Compare
a1c0e0a to
78b0d96
Compare
f9cf1bf to
1ef8502
Compare
|
This PR was not merged into |
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.rollout_collectionas aliases._moved_paths.pyrecords the two exception classesrollout_collectionno longer imports, so old imports throughnemo_gym.rollout_collectionstill resolve.benchmarks/gdpval,resources_servers/gdpval,resources_servers/long_transduction,responses_api_agents/hermes_agent,scripts/harness_conformanceand the unit tests import fromglobal_config.Behavior does not change.
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. The moved-paths test checks that every old name still resolves.
Rollout evidence
N/A. A refactor with no behavior change.
Compatibility
Old imports keep working through the aliases and
_moved_paths.py.