Repository navigation
fix(orchestration): always install the ray extra in the eval driver - #4815
Conversation
…es Ray Ray became an optional extra, but the driver that gym eval submit renders with driver.gym_install still installs Gym without it, so a benchmark whose server declares ray_enabled = True fails at startup. Add the ray extra to the driver's install when a server in the benchmark's config_paths declares it, using the same entrypoint check that gym env start uses. A run without such a server keeps its install line byte for byte. gym env start is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
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 72e4f9a |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD — two RISK findings in the new configuration scan: valid submissions can fail during rendering, and explicit run overrides can be ignored when selecting the Ray dependency.
Reviewed all five changed files and traced the affected configuration-composition and driver-installation paths. 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.
Addresses review comment 4338918904 on NVIDIA-NeMo#4815. ray_extra lists servers before inheritance is applied, and the server listing indexes the first key of each mapping. A valid config with an empty _inherit_from template (empty_defaults: {}) therefore raised IndexError and the job script never rendered, although runtime consumes that template and starts normally. Empty mappings hold no server, so detection now drops them before it lists servers. gym env start is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Addresses review comment 4338918914 on NVIDIA-NeMo#4815. ray_extra read only the config_paths files, but gym eval run applies the run's overrides on top of them. An entrypoint set or interpolated through a run override was therefore missed or misjudged: an override that selects a Ray entrypoint got a plain install and then failed at startup, and one that selects a non-Ray entrypoint got the ray extra. Detection now applies each run override at the dotted path flatten_run_args hands to gym eval run, with values left unresolved, so it lists the same servers as runtime. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…onfig persist() writes the resolved config with host: values put back as their references, but every lit: value lost its prefix. Reading that file with SubmitConfig.model_validate, as a resubmit does, then fails the env check for each bare literal (for example HF_HOME: /cache/huggingface), so nothing is queued. The dump now writes lit: back on every literal. host: values stay as their references, so no resolved secret reaches the record, and runtime: values already carry their own prefix. A saved config now validates with the same rules as a submit. A saved_config validation context reads an env value without a prefix as lit:, so records written before this change load again. That is safe because the old dump wrote only three forms: host: references, runtime: values and bare literals. A bare value in a saved record can therefore only be a literal, and reading it as lit: yields the value the job was submitted with. The context is opt-in, so a config a user writes is still refused without a prefix. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
This reverts commit 14e1b68. This branch predates `gym eval resubmit`, so nothing here reads a saved config back, and the change could not do what it was meant to. The complete fix, with the resubmit reader and the `driver.policy_model` round trip, is built on current main. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD — four RISK findings remain in driver dependency detection.
Completed the reset/full review of all 11 changed files and traced configuration composition, both driver installers, server startup, and HTTP-client initialization. The previous list-traversal and per-server exception-handler fixes are present, including their regression assertions. Those concrete findings are closed; the comments below describe different failures.
No additional correctness finding in the HTTP-client change. Cached/injected configuration and the explicit-parser fallback were source-traced. Static review only: tests were not executed. Suggested changes below require author verification before adoption.
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.
| + exporter_extras(benchmark.run) | ||
| + gitlab_storage_extras(benchmark.prepare) | ||
| + gitlab_storage_extras(benchmark.run) | ||
| + ray_extra(benchmark.run) |
There was a problem hiding this comment.
RISK — Include the model-type config in dependency detection
Failure / blast radius: Submit GPQA with gym_install enabled, a valid driver.policy_model, and driver.policy_model_type: local_vllm_model. The generated command includes --model-type local_vllm_model, but this scan receives only benchmark.run, so it emits a plain install. The CLI adds the selected model config to config_paths; that config selects an entrypoint declaring ray_enabled = True. Startup then reaches the missing-Ray rejection. The Kubernetes caller has the same mismatch.
Correction: Give ray_extra a keyword-only policy_model_type: str | None = None argument and include that asset before the run's paths, matching CLI merge order. Inside its existing try, replace the path-loading statement with this suggested code:
paths = list(run.get(CONFIG_PATHS_KEY_NAME) or [])
if policy_model_type:
from nemo_gym.cli.main import _asset_config_path
paths.insert(0, _asset_config_path("model-type", policy_model_type))
_, configs = GlobalConfigDictParser().load_extra_config_paths(paths)Both renderers must pass policy_model_type=policy_type if config.driver.policy_model else None. Invoke the detector only when gi is set and benchmark.command is None; otherwise its result cannot affect an install. Keep subsequent run overrides winning over the composed files. The invariant is that dependency detection includes every config the generated command selects, using the same asset/flavor resolution rather than guessing a filename.
Preservation / acceptance — proposed tests: In both renderers, GPQA plus a policy service and local_vllm_model must install ray; selecting openai_model must retain the plain install. An empty model type, or a nondefault type with no policy_model, must not add a model config. Check a name/flavor selector against the CLI resolver. Retain the existing non-Ray→Ray, Ray→non-Ray, dotted-override, and inherited-entrypoint expectations in the detection tests. With no gym_install, neither renderer should inspect dependency configs.
There was a problem hiding this comment.
No longer applies: the Ray detection this was about is gone at c678ead. Every job now installs ray together with the requested extras, so no config can drop it.
| servers = list( | ||
| _configured_servers(OmegaConf.create(_without_empty_mappings(merged)), skip_unresolved_roots=True) | ||
| ) | ||
| except (ConfigError, OmegaConfBaseException) as e: |
There was a problem hiding this comment.
RISK — Do not discard a known Ray requirement when another config is unreadable
Failure / blast radius: ray_extra({"config_paths": ["benchmarks/wmt24pp/config.yaml", "/lustre/me/overlay.yaml"]}) returns () when the overlay is absent on the submitting machine—even though WMT24++ requires Ray. A valid overlay can exist on the cluster and be mounted into the driver: this is the documented arrangement for user-owned files, and Slurm renders locally before connecting to the remote host. load_extra_config_paths raises on that one path, so the entire scan is discarded. The queued driver installs without Ray and fails before rollouts.
Correction: A load/enumeration failure is an indeterminate dependency check, not evidence that Ray is unnecessary. The smallest contained correction is to make this the deliberate logged exception boundary and return the conservative extra:
except Exception as e:
logger.warning(
"Could not determine the benchmark's dependencies; "
"installing Gym with Ray: %s", e
)
return ("ray",)This also contains AssertionError/TypeError from entrypoint enumeration, which currently escape the narrower handler. Keep successful scans selective; do not add Ray unconditionally to readable non-Ray runs. The documentation row should state this fallback and that inspection uses the submitting checkout.
Preservation / acceptance — proposed tests: Render both executors with WMT24++ plus a nonexistent submit-local overlay and require ray in the install extras, in either path order. An unreadable-only path should also take the conservative fallback and log why. Change the malformed-YAML test to expect that same policy. Readable GPQA/LMArena must still install without Ray, readable WMT24++ with Ray, and unrelated unresolved scalar/list settings must retain their existing selective results. Absolute or null entrypoints should not escape this best-effort check; normal runtime enumeration must still reject them.
There was a problem hiding this comment.
No longer applies: the Ray detection this was about is gone at c678ead. Every job now installs ray together with the requested extras, so no config can drop it.
| GlobalConfigDictParser()._recursively_swap_keys(applied, resolve_list_items=False) | ||
| except Exception as e: # Best effort: detection must never fail a submit that rendered before. | ||
| logger.warning("Could not apply config inheritance to check whether the run needs Ray: %s", e) | ||
| return config |
There was a problem hiding this comment.
RISK — Preserve applied inheritance across unrelated job-only scalar values
Failure / blast radius: Use the existing uses_ray/no_ray server fixtures, combine GPQA with this overlay, leave ONLY_IN_JOB unset on the submitter, and provide driver.env: {ONLY_IN_JOB: 'lit:value'}:
base:
resources_servers:
no_ray: {entrypoint: app.py, domain: other}
s:
_inherit_from: base
resources_servers:
no_ray: {entrypoint: ../uses_ray/app.py}
job_only: ${oc.env:ONLY_IN_JOB}GPQA moves an agent through inheritance, so the swap calls _retarget_environment_servers. Its iteration over every resolved top-level value raises on job_only. This fallback then discards all applied inheritance. Raw enumeration sees the non-Ray base and skips s, whose first key is _inherit_from, producing a plain install. In the driver the variable exists, inheritance succeeds, and s requires Ray. The earlier list-value fix does not cover this scalar/agent-retarget path.
Correction: Make the detection-time retarget traversal skip an unresolved top-level value without reverting the configuration. One contained implementation is to add a keyword-only skip_unresolved_roots=False option to _recursively_swap_keys and _retarget_environment_servers, forward it at the retarget call, and pass True from this detector alongside resolve_list_items=False. Replace the retarget loop with:
for name in global_config_dict:
try:
instance = global_config_dict[name]
except InterpolationResolutionError:
if not skip_unresolved_roots:
raise
continue
# Keep the existing mapping/reference traversal here.InterpolationResolutionError is already imported there. Keep runtime callers at the default. Do not simply iterate raw nodes: a readable interpolation can legitimately resolve to an environment-server mapping and still needs retargeting. The invariant is that unrelated unavailable scalar values cannot undo known entrypoint overrides or resurrect a moved source.
Preservation / acceptance — proposed tests: Extend the inheritance fixtures with GPQA and the scalar above: non-Ray→Ray must install Ray, Ray→non-Ray must remain plain, and inherited Ray without an override must install Ray, for both executors. Inspect the composed detection copy: base must be removed and s must have the overridden entrypoint. Verify that GPQA's environment-server reference still names its renamed agent, including a readable mapping-alias case. Retain the unresolved-list/directives-in-list assertions and strict-versus-skip server-listing assertions at lines 219–299.
There was a problem hiding this comment.
No longer applies: the Ray detection this was about is gone at c678ead. Every job now installs ray together with the requested extras, so no config can drop it.
| try: | ||
| _, configs = GlobalConfigDictParser().load_extra_config_paths(list(run.get(CONFIG_PATHS_KEY_NAME) or [])) | ||
| servers = [] | ||
| if configs: |
There was a problem hiding this comment.
RISK — Apply inline server overrides even when no config files were loaded
Failure / blast radius: BenchmarkRunConfig.run accepts inline configuration, and the renderer forwards every nested leaf as a Hydra override. However, this if configs also gates applying those overrides. Using _write_server(..., "uses_ray", ray_enabled=True), start with _config([]) and add:
config.driver.benchmarks["bench"].run.update({
"s": {"resources_servers": {"uses_ray": {
"entrypoint": "app.py", "domain": "other"
}}}
})Detection returns () without inspecting s, while the runtime parser merges the CLI configuration and then applies inheritance. Runs declaring their server configuration inline therefore still receive an install missing Ray. Both executors share this failure.
Correction: Initialize an empty composition when there are no files, then run the existing override/swap/enumeration block unconditionally. Suggested replacement for this guard:
merged = OmegaConf.merge(*configs) if configs else OmegaConf.create({})Dedent the existing block from the override loop through server enumeration. The invariant is that an empty file list does not mean an empty effective run configuration.
Preservation / acceptance — proposed tests: With the fixture above, both renderers must include ray; repeat with the config_paths key omitted. A corresponding inline no_ray server and a genuinely empty run must retain the plain install. Assert that detection lists the same inline server/entrypoint as _configured_servers(OmegaConf.create(run)). Retain the file-backed direct, dotted, and reverse override expectations in the existing tests, along with the job-only interpolation cases.
There was a problem hiding this comment.
No longer applies: the Ray detection this was about is gone at c678ead. Every job now installs ray together with the requested extras, so no config can drop it.
Review showed that detecting whether a benchmark needs Ray re-implemented how Gym composes a run's config, and each round found a case it missed. It still missed one: the policy model config that --model-type adds, while local_vllm_model and genrm_model declare ray_enabled = True. The driver now always installs Gym with the ray extra. A missing Ray fails the whole job; an unneeded one costs one install, and uv only warns when a checkout does not define the extra. This removes the detection and the parser flags it needed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…mits through the injected config Review asked for three changes to the Ray worker client fix: - a test of get_global_aiohttp_client with an explicit parser config, a path no caller takes, so the function's no-cover pragma can go; - telemetry tests that set the limits through NEMO_GYM_CONFIG_DICT, the path a server worker takes, instead of patching the lookup by its import name; - a note in the OpenSandbox config that a process without the Gym config, such as a Ray task worker, uses the default pool limits. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
With ray always added, "[telemetry]" can no longer appear in the install line, so asserting its absence passed even when telemetry was installed. The test now asserts the whole `".[ray]"` line. The client comment also says exactly which processes get the default limits. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test c678ead |
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP — LGTM — no reliability concerns.
Completed the reset/full review of all ten changed files and traced the affected Slurm, Kubernetes, server-startup, and HTTP-client paths.
The four RISK findings from review 5634110299 are resolved: the shared driver installer now always includes Ray when installing Gym, removing dependency detection and its configuration-composition failures. Without gym_install, no installation is emitted.
The HTTP-client change preserves cached/injected configuration and explicit-parser behavior while avoiding implicit argv parsing in unconfigured workers. The new tests assert default limits without config caching and explicit-parser limits of (7, 3); the telemetry tests now exercise real environment injection.
Static source review only; tests were not executed. No qualifying findings remain.
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.
Signed-off-by: Adam Rajfer <[email protected]>
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40517926852 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40521484476 |
The evaluation driver now installs the Ray extra together with its existing extras before starting configured servers. Ray-backed servers can therefore import Ray in a fresh driver environment.
flowchart LR A[Check out Gym] --> B[Install existing extras plus ray] B --> C[Start configured servers]The HTTP-client configuration fix has been extracted into #5093 as requested in review. This PR now contains only driver installation, its documentation, and tests; prefer landing #5093 first.
Validation: 328 Ray-installation/orchestration tests pass on main plus this change; 581 tests pass with #5093 applied as well. The separate HTTP PR also passed an actual Ray-worker HTTP request.