Repository navigation
fix(server-runtime): set up Ray server venvs on every Ray node - #6336
puneeshkhanna wants to merge 5 commits into
Conversation
|
Thanks for tracking this down. The cross-node interpreter gap is real for multi-node Ray clusters whose venvs live on node-local storage. The main decision is scope. As written, the step runs on every start, for every Ray-enabled server, on every other node, and nothing turns it off. That changes startup for setups that work on main today, including NeMo RL's, which bakes venvs into its image or keeps them on shared storage (see the comment on the call site in Before merge, the step also needs to:
A fake |
Servers that declare `ray_enabled = True` run Ray tasks with their own venv's interpreter (`py_executable=sys.executable`), but the supervisor only sets up that venv on the node where `gym` runs. On a multi-node Ray cluster with node-local venvs, tasks scheduled on other nodes fail because the interpreter does not exist there. Before spawning servers, run each Ray server's venv setup on every other alive Ray node (one task per node, pinned with node affinity and requesting no CPUs from Ray, so nodes with all CPUs reserved still run it). Nodes that share the venv's storage with the head node are detected with a probe file and skipped. The step is a no-op on a single-node cluster and is bounded by `server_spinup_timeout_seconds`. Signed-off-by: Puneesh Khanna <[email protected]>
…review - Opt-in via `setup_venvs_on_every_ray_node` (default off), so default startup is unchanged. - Pass forwarded env vars (UV_* and three NEMO_GYM_* names) as a task argument instead of runtime_env, which Ray logs. - Tolerate read-only venv storage; rename the probe file to a shared-storage marker and ignore it in git. - Raise ServerSpinupTimeoutError / ServerStartFailedError naming the nodes and servers; the setup time counts against server_spinup_timeout_seconds. - Skip nodes that can no longer run tasks; per-node setup log names. - Unit tests with a fake ray module; document the requirements. Signed-off-by: Puneesh Khanna <[email protected]>
dc0482d to
cdc8c71
Compare
|
@ananthsub - All points addressed in cdc8c71:
|
…tup failures - The readiness timeout says how long venv setup on other Ray nodes took from the budget. - Tests: the readiness timeout counts that setup time; a failed per-node setup command names the server and node; the per-node step runs only with setup_venvs_on_every_ray_node set. Signed-off-by: Puneesh Khanna <[email protected]>
|
/ok to test 0d323d9 |
|
please fix the linting error so we can merge |
@ananthsub - Can you point to the specific lint error ?. Failing check seems "Harness conformance (non-blocking)", whose failures are in the claude_code, terminus_2_sandboxed and miniswe_sandboxed probes. That job fails the same way on main's latest CICD run (1883e25) |
yaoyu-33
left a comment
There was a problem hiding this comment.
harbor_agent is deprecated. For new Harbor workloads, please use the harbor environment server.
Which benchmark or task set, agent harness, and sandbox backend are you running on the KubeRay cluster? Is there anything in that setup that you still need harbor_agent for?
One configuration detail for the current run: use an absolute uv_venv_dir. If the driver and worker start in different directories, a relative path can install the venv somewhere other than where the task expects its interpreter.
…-every-ray-node Signed-off-by: Puneesh Khanna <[email protected]> # Conflicts: # nemo_gym/server_runtime/supervisor/server_supervisor.py
d9e330a
|
/ok to test d9e330a |
|
@puneeshkhanna could you answer @yaoyu-33's questions from 2026-11-23: which benchmark or task set, agent harness and sandbox backend you run on the KubeRay cluster, and whether anything there still needs |
Servers that declare
ray_enabled = Truerun Ray tasks with their own venv's interpreter (py_executable=sys.executable), but the supervisor only sets up that venv on the node wheregymruns. On a multi-node Ray cluster with node-local venvs, tasks scheduled on other nodes fail because the interpreter does not exist there.Before spawning servers, run each Ray server's venv setup on every other alive Ray node (one zero-CPU task per node, pinned with node affinity). Nodes that share the venv's storage with the head node are detected with a probe file and skipped. The step is a no-op on a single-node cluster and is bounded by
server_spinup_timeout_seconds.What does this PR do?
Servers that declare
ray_enabled = True(e.g.harbor_agent,swe_agents,mini_swe_agent) run Ray tasks with their own venv's interpreter (py_executable=sys.executable), but Gym sets that venv up only on the nodegymruns on. On a multi-node Ray cluster with node-local venvs, tasks scheduled on other nodes fail because the interpreter is missing there.This adds an opt-in step, enabled with
setup_venvs_on_every_ray_node: true(default off). Before spawning servers,ServerSupervisorsets up each Ray server's venv on every other alive Ray node:UV_*,NEMO_GYM_ALLOW_PRERELEASE,NEMO_GYM_EXTRA_ROOTSandNEMO_GYM_ALLOWED_COMPONENT_ROOTSare forwarded, as a task argument (notruntime_env, which Ray logs).server_spinup_timeout_seconds. A timeout raisesServerSpinupTimeoutErrorand a failed node raisesServerStartFailedError, both naming the nodes and servers; the readiness timeout reports how much of the limit the setup used.TaskUnschedulableError, e.g. draining) are skipped. Each node writes its own setup log (<server>@<node ip>).Docs: the requirements (same absolute paths on every node,
uvon the Ray processes'PATH) are on the "Scale CPU work with Ray" page, and the troubleshooting page notes that the setup counts against the spin-up timeout.No linked issue; found running
harbor_agenton a multi-node KubeRay cluster with node-local venvs.Validation
tests/unit_tests/server_runtime/supervisor/test_server_venvs_on_ray_nodes.py(fakeraymodule) andtests/unit_tests/cli/test_cli.py(shared budget, key gating); each fails when the line it covers is reverted.uv_venv_dir: the venv is built on the worker, and a Ray task pinned there runs with that venv's interpreter;uv_venv_dir: the worker skips setup and the markers are removed;ServerStartFailedErrornaming the worker's IP;NEMO_GYM_*token set on the driver appears in no Ray log on either node; the worker'sruntime_env_agent.logshows onlypy_executable.ruff check/ruff format --checkon the changed files.Rollouts
N/A: only server startup changes, and only with the new key set. Agent, verifier and scoring behavior are unchanged.
Compatibility and benchmark impact
None by default:
setup_venvs_on_every_ray_nodedefaults to false, and startup is then unchanged. With it set, startup additionally sets up Ray servers' venvs on the other Ray nodes alive at startup (nodes that join later are not covered), withinserver_spinup_timeout_seconds.Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).