Skip to content

fix(orchestration): worker nodes wait for Ray head port before symmetric-run - #4730

Merged
ananthsub merged 2 commits into
mainfrom
wprazuch/eval-1707-ray-worker-wait
Oct 20, 2026
Merged

ananthsub merged 2 commits into
mainfrom
wprazuch/eval-1707-ray-worker-wait

Conversation

@wprazuch

Copy link
Copy Markdown
Contributor

What changed

In nemo_gym/orchestration/executors/script_templates.py, worker nodes now poll the head node's Ray port (6379) before calling ray symmetric-run.

Why

Ray 2.59 has a bug: check_head_node_ready() creates a GcsClient outside its retry loop, so RAY_SYMMETRIC_RUN_CLUSTER_WAIT_TIMEOUT=600 has no effect. Workers give up after ~40 s regardless.

On top of that, the head node installs ray[default] at runtime (7–177 s observed) before starting Ray, so workers often reach their retry limit before the head's port is even open.

Fix

Before handing off to ray symmetric-run, worker nodes (SLURM_NODEID != 0) use bash /dev/tcp to poll $HEAD_NODE_IP:6379 up to the existing 600 s deadline. If the port stays closed, the worker exits with an error message instead of silently timing out.

The head node (SLURM_NODEID = 0) skips the wait and starts Ray as before.

Validation

  • Manually verified: a head node delayed by 60 s and by 230 s — workers connected cleanly both times.
  • 227 unit tests pass.
  • pre-commit run --all-files clean.

@copy-pr-bot

copy-pr-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@wprazuch

Copy link
Copy Markdown
Contributor Author

/ok to test 2fdfc9a

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team October 19, 2026 09:38
@yaoyu-33 yaoyu-33 added area:orchestration Job submission, deployment, services, and lifecycle management bug Something isn't working complexity:low Localized change in one scope with a small, straightforward review surface needs-review PR is ready for code review and waiting on a reviewer labels Oct 19, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 20, 2026
…ric-run

Ray 2.59.0 constructs GcsClient outside the retry loop in
check_head_node_ready(), so RAY_SYMMETRIC_RUN_CLUSTER_WAIT_TIMEOUT=600
has no effect and workers time out after ~40 s. Runtime pip install of
ray[default] also makes the head node start late (7-177 s observed).

Before calling ray symmetric-run, worker nodes (SLURM_NODEID != 0) now
poll HEAD_NODE_IP:6379 via bash /dev/tcp until the port is open or the
600 s deadline expires. Verified in Slurm jobs 1322224 (head 60 s late)
and 1322062 (head 230 s late).

Signed-off-by: Wojciech Prazuch <[email protected]>
Port the three bash-level tests from the internal review:
- worker waits for a late head then joins (parametrised for ray
  symmetric-run and the older-Ray ray-start fallback path)
- worker exits 1 with a clear message when the head never comes up
- head does not wait for its own GCS port

Also tighten the implementation slightly to match:
- move the wait before the symmetric-run/help probe so both Ray
  branches are covered
- use $RAY_HEAD_NODE_IP (IP:port) with bash string splitting instead
  of a hard-coded :6379, and use $SECONDS instead of $(date +%s)
- add echo progress/error lines so operators can see what is happening

Signed-off-by: Wojciech Prazuch <[email protected]>
@wprazuch
wprazuch force-pushed the wprazuch/eval-1707-ray-worker-wait branch from 2fdfc9a to 9905e0c Compare October 20, 2026 08:48
@wprazuch

Copy link
Copy Markdown
Contributor Author

/ok to test 9905e0c

@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 20, 2026
@wprazuch
wprazuch added this pull request to the merge queue Oct 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39424129701

@wprazuch
wprazuch removed this pull request from the merge queue due to a manual request Oct 20, 2026
@ananthsub
ananthsub added this pull request to the merge queue Oct 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39454840488

Merged via the queue into main with commit b544e5e Oct 20, 2026
49 of 54 checks passed
@ananthsub
ananthsub deleted the wprazuch/eval-1707-ray-worker-wait branch October 20, 2026 16:23
AdamRajfer added a commit to AdamRajfer/Gym that referenced this pull request Oct 20, 2026
Resolve the import conflict in tests/unit_tests/test_slurm_script.py with NVIDIA-NeMo#4730 by keeping both sides imports.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 9905e0cd Deployed Oct 20, 2026 by copy-pr-bot[bot] via release / finalize / notify #5933
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:orchestration Job submission, deployment, services, and lifecycle management bug Something isn't working complexity:low Localized change in one scope with a small, straightforward review surface needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants