Skip to content

feat(dynamo): run generation fleet health behind the Dynamo frontends - #5349

Open
jthomson04 wants to merge 5 commits into
NVIDIA-NeMo:mainfrom
jthomson04:jthomson04/dynamo-fleet-health-main
Open

jthomson04 wants to merge 5 commits into
NVIDIA-NeMo:mainfrom
jthomson04:jthomson04/dynamo-fleet-health-main

Conversation

@jthomson04

@jthomson04 jthomson04 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What and why

Problem. With policy.generation.dynamo: true, async_rl.generation_fleet_health was refused at startup. The Dynamo frontends pick engines themselves, so they would keep routing to a quarantined shard, and a restarted shard would never register.

Change. The SingleController now tells the generation backend which shards are in service (GenerationInterface.set_serving_shards, a no-op by default). It does so on every fleet probe and once before generation resumes after a refit. Behind Dynamo, VllmGeneration makes the frontends' routing match:

Shard event What happens behind Dynamo
Leaves service, process alive Its engine unregisters its discovery record. Requests in flight finish.
Leaves service, process dead Nothing to do: the record goes with the process's etcd lease.
Quarantined and does not confirm leaving Its workers are killed, so the record lapses.
Restarted It does not start its Dynamo endpoint yet: it holds initial weights.
Returns to service after a refit It starts its endpoint (new process) or registers again (same process).

A call through a frontend does not say which engine failed it. So for an engine served through Dynamo, the liveness probe also fails when the engine's endpoint stopped serving or vLLM reports its engine core dead.

sequenceDiagram
    participant SC as SingleController
    participant Gen as VllmGeneration
    participant E as Engine, shard 0
    participant FE as Dynamo frontends
    Note over E: process dies
    SC->>Gen: set_serving_shards({1}, quarantined={0})
    Note over FE: shard 0's record lapses with its etcd lease
    SC->>Gen: restart_shard(0)
    Note over E: new process, no Dynamo endpoint yet
    SC->>E: refit
    SC->>Gen: set_serving_shards({0, 1})
    Gen->>E: start the Dynamo endpoint
    E->>FE: register
    SC->>Gen: resume generation
Loading

Native vLLM behaves as before: the hook is a no-op without Dynamo, and is_alive still returns True there (the base method only gains a -> bool annotation).

No config key is added or changed.

Limits, also listed in docs/guides/dynamo-generation.md:

  • An engine that hangs without dying is not detected behind Dynamo. That is a follow-up PR.
  • A killed engine stays listed until its etcd lease expires (30 s on Dynamo 1.8).
  • A checkpoint generation cut does not reach an engine that left the routing but is still alive.

Replaces #4955, which is stacked on the unmerged #4954 and edits files that main has since replaced.

Issues

None.

Convergence / perf / functionality proof

tests/functional/grpo_sc_generation_shard_recovery.sh on one GB200 node (4 GPUs). CI's 2-GPU runners skip this test, so it was run by hand. Each run finished all 24 steps.

Variant Result W&B
Dynamo, shard killed inside a refit and restarted (KILL_DURING_REFIT=true RESTART_DEAD_SHARDS=true) Pass kw5t6i73
Dynamo, shard killed and restarted (RESTART_DEAD_SHARDS=true) Pass yj2m4bsv
Dynamo, shard killed Pass on the second attempt hyr2cilx
Native vLLM, shard killed Pass gkwi75n8

The first run is on this head. The other three ran before the review fixes, which rewrote the routing code.

  • Kill inside a refit. Generation resumed about a second after the refit aborted, while the dead engine was still listed. 97 calls routed to it failed (HTTP 500 or 503) and passed on the rollout client's first retry; no rollout failed. The replacement joined the routing after its refit and then took 4,510 requests (survivor 7,063). The frontends routed to three engine ids, which the test now requires.
  • Kill at a step boundary. Every frontend response was 200 (12,806 and 12,808). In the restart run the shard left the routing, restarted, was refit, rejoined, and only then did generation resume. In the plain kill the survivor took traffic about 15 s after the kill, inside the dead engine's 30 s lease.
  • The first plain-kill attempt was the first run on the node. It hit the test's 20-minute wait for step 3 while the engines were still starting cold, before any shard was killed.

A local check against real Dynamo 1.8 frontends (2 GPUs, two Qwen3-0.6B shards, no trainer) passes 32 of 32 assertions on this head:

  • an unregistered engine leaves both frontends in under 0.25 s, and returns as fast;
  • a frozen, quarantined shard is killed, and its record goes when the lease lapses;
  • a restarted shard is listed only once it is back in service, also when it was restarted while no push ran;
  • repeated "leave" calls on a live engine are harmless;
  • a dead engine core fails the liveness probe.

The Dynamo lane's first fast line, now with fleet health on, passes on 2 GPUs. Unit tests, ruff and pyrefly pass on this head.

Needs upstream changes

None.

PR commands and CI
  • CI label, exactly one:
    • CI:Lfast: the default for most PRs. Runs a fast test subset.
    • CI:L1: dependency or container changes (pyproject.toml, uv.lock, Dockerfile) or broad core changes. Builds a new image and runs unit and functional tests.
    • CI:docs: docs-only changes. Runs doc tests only.
  • /ok to test <full-commit-sha>: start CI for that commit. Post again after each push.
  • /review: automated review comments. Add mode=strict for a stricter review, reset=true for a fresh full review.
  • /resolve-conflict: Autobot merges main into this PR and resolves the conflicts. PRs from forks must allow edits by maintainers.
  • Locally: /review-pr-team <pr-number> for a team review before you ask for human review.
  • Contributor guidelines

🤖 Generated with Claude Code

With policy.generation.dynamo=true, async_rl.generation_fleet_health was
refused at startup: the frontends pick engines themselves, so they kept
routing to a quarantined shard, and a restarted shard never registered.

The SingleController now tells the generation backend which shards are in
service (GenerationInterface.set_serving_shards, a no-op by default), on
every fleet probe and before generation resumes after a refit. Behind
Dynamo, VllmGeneration makes the frontends' routing match:

- a shard leaving service unregisters its discovery record, so every
  frontend stops routing to it while its requests in flight finish;
- a quarantined shard that does not confirm is killed, so its
  registration goes with its etcd lease;
- a restarted shard starts its Dynamo endpoint only once a refit has
  returned it to service.

A call through a frontend does not say which engine failed it, so behind
Dynamo the liveness probe also fails when the engine's endpoint stopped
serving or vLLM reports its engine core dead.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 21, 2026

Copy link
Copy Markdown

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.

@jthomson04

Copy link
Copy Markdown
Contributor Author

/ok to test 222b24a

@github-actions github-actions Bot added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) Documentation Improvements or additions to documentation and removed CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) labels Nov 21, 2026

@jthomson04 jthomson04 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 222b24a5ac by five reviewers and two adversarial passes. Every finding below was reproduced or run. All the suggested changes were applied together on a scratch copy: pinned ruff is clean and the PR's unit tests pass (101, 14, 6 and 26 passed in the four selections that touch the changed files).

The design is right: one hook on the backend, the whole serving set on every push, and the fleet monitor stays the only place that decides whether a shard may serve. What the PR assumes about Dynamo holds on the pinned Dynamo nightly, checked against two real frontends: unregister_endpoint_instance() removes only the instance record, both frontends stop routing within milliseconds, calls in flight finish, and register_endpoint_instance() puts the same instance back. Native vLLM behaves as on main.

  1. (C1) A shard restarted during a refit can end up never registered with the frontends, with no error. Asks for a fix and one run.
  2. (C2) An unreachable actor is taken for a dead process, so a quarantined engine that is alive is not killed.
  3. (C3) test_watchdog_pump.py now raises inside the pump on every tick and still passes.
  4. (C4) No CI job runs the two new lane lines, and the lane does not say so.
  5. (C5) The guide's "fail and are retried" is true only for calls without a session, and its quarantine row leaves out the wait.
  6. (C6) The routing calls and the routed flag belong on DynamoEngineAdapter. Low severity.
  7. (C7) The functional check passes for a replacement that never took a request.
  8. (C8) The comment on why the push is skipped while a refit recovers is true for one of the three ways a refit can fail.
  9. (C9) The design doc's Dynamo-upgrade list does not name the new Endpoint calls.
  10. (C10) Nothing tests why a restarting shard is not quarantined.

For context, no action:

  • What the functional proof covers. NeMo RL's own rollouts, with the kill at a step boundary. Not run anywhere: NeMo-Gym with fleet health behind Dynamo, a shard lost during a refit behind Dynamo (C1 asks for this one), and, against a real frontend, a live engine's unregister call and the kill of a quarantined shard. Both lane lines SIGKILL the shard, so they only reach its process is gone.
  • Upstream. A session bound to an engine that is dead but still listed gets HTTP 500 until the lease expires, because the binding is a hard constraint by default. Dynamo has --router-session-affinity-mode soft at the pin; it was not measured.
  • Lost link to etcd. An engine that cannot reach etcd for longer than its lease loses its Dynamo endpoint for the rest of that process. The new probe then fails the shard, which is the right outcome, but the guide does not name this cause.
  • CI on this head. Lint check passes. No unit or functional lane has run.

Generated by Claude Code

Comment thread docs/guides/dynamo-generation.md Resolved
Comment thread nemo_rl/algorithms/single_controller.py Resolved
Comment thread docs/design-docs/dynamo-integration.md Resolved
Comment thread nemo_rl/algorithms/single_controller.py Resolved
jthomson04 and others added 2 commits November 21, 2026 15:01
Review of the fleet-health change (C1-C10):

- set_serving_shards records the leader each routed shard registered from.
  A restart swaps the leader, so a replaced shard is out of the routing
  before any call is built, and its replacement is asked to start its
  endpoint when it returns to service. Calls are no longer kept across
  pushes: a shard that did not confirm is asked again by the next push.
- Only ActorDiedError means an engine's process is gone. A quarantined
  shard that is unreachable or silent is killed.
- DynamoEngineAdapter.set_routed holds the register and unregister calls
  and the routed flag. The worker keeps its adapter only once the endpoint
  started, so a start that raised is tried again.
- _push_serving_shards catches its own failure, for both callers.
- Tests: the watchdog fixture carries what the pump reads; the functional
  check requires the replacement to have taken a request; the Dynamo lane
  says when its shard-loss tests skipped and runs one fast line with fleet
  health on.
- Docs: who retries calls to a dead engine, what probe_timeout_s also
  bounds, and the Endpoint calls a Dynamo upgrade has to re-check.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: jthomson04 <[email protected]>
@jthomson04

Copy link
Copy Markdown
Contributor Author

/ok to test 99b6527

@github-actions github-actions Bot added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Nov 22, 2026
@jthomson04
jthomson04 marked this pull request as ready for review November 23, 2026 00:05
@copy-pr-bot

copy-pr-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@jthomson04

Copy link
Copy Markdown
Contributor Author

/ok to test 77b1c50

@jthomson04
jthomson04 requested a review from yuki-97 November 28, 2026 01:46
@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026
…leet-health-main

Signed-off-by: jthomson04 <[email protected]>

# Conflicts:
#	tests/unit/models/generation/test_dynamo_vllm_adapter.py
@jthomson04

Copy link
Copy Markdown
Contributor Author

/ok to test e59936e

@svcnvidia-nemo-ci svcnvidia-nemo-ci added complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:none Cannot change training results. Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) labels Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:none Cannot change training results. Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants