Skip to content

refactor(router): delete the runtime-bound KV router scheduler - #31

Closed
ishandhanani wants to merge 1 commit into
idhanani/p2-direct-dispatch-migrationfrom
idhanani/p1-delete-runtime-scheduler
Closed

ishandhanani wants to merge 1 commit into
idhanani/p2-direct-dispatch-migrationfrom
idhanani/p1-delete-runtime-scheduler

Conversation

@ishandhanani

Copy link
Copy Markdown
Owner

Stacked on #30. Phase 1 exit: "then delete the old wiring".

Summary

  • The frontend router always schedules on an embedded selection-service partition. KvScheduler, the runtime sequence publisher/constructors, the direct-ZMQ active-sequence ingress, the RouterScheduler two-variant dispatch, and the LoRA estimator's uncalled scheduler polling are removed (about 2,100 lines). kv_router/scheduler.rs keeps only runtime-free re-exports; KvRouter<Sel> keeps its type parameter for API compatibility.
  • Caller-injected WorkerSelector types (anything but the default selector or a registry WorkerSelectionPolicy) now run inside the partition through WorkerSelectionPolicy::delegated / the new DelegatedWorkerSelector trait and ErasedWorkerConfig (config-erased worker view, projected back onto ModelRuntimeConfig by the embedded host). The existing unit tests with fake selectors pass unchanged.
  • router_worker_registered is maintained by the embedded catalog feeder. router_embedded_selection is deprecated and ignored (false warns). Docs, .pyi, and the frontend flag help updated.

Validation

  • cargo test -p dynamo-llm --lib: 2557 passed (all kv_router::, routing_host, prefill_router tests, including the fake-selector tests now running through the delegated policy).
  • cargo test -p dynamo-kv-router --features standalone-selection --lib -- services: passes. cargo clippy -p dynamo-llm -p dynamo-kv-router --all-targets: clean. cargo check --workspace --all-targets and bindings cargo check: clean. docs_lint.py: 0 errors.
  • Router e2e (mockers) rerun on this head: see final comment.

The frontend router now always schedules on an embedded selection-service
partition. Remove `KvScheduler` (kv_router/scheduler.rs keeps only its
runtime-free re-exports), the runtime sequence publisher and its
constructors, the direct-ZMQ active-sequence ingress, the two-variant
`RouterScheduler` dispatch, and the LoRA load estimator's uncalled
scheduler polling. `KvRouter<Sel>` keeps its type parameter for API
compatibility (`PhantomData<fn() -> Sel>`).

A caller-injected `WorkerSelector<ModelRuntimeConfig>` that is neither the
default selector nor a registry `WorkerSelectionPolicy` now runs inside the
partition: `WorkerSelectionPolicy::delegated` (new `DelegatedWorkerSelector`
trait in dynamo-kv-router) hands the selector the scheduling request and a
config-erased view of the eligible workers (`ErasedWorkerConfig`), which the
embedded host projects back onto `ModelRuntimeConfig`. The unit tests that
inject fake selectors run unchanged on that path.

The per-worker `router_worker_registered` gauge is now maintained by the
embedded catalog feeder. `router_embedded_selection` is deprecated and
ignored; `false` logs a warning. Four sequence-level tests that built the
runtime sequences directly are removed; their behavior is covered by the
replica-lifecycle and session-affinity e2e tests on the embedded path.

Signed-off-by: Ishan Dhanani <[email protected]>
@github-actions github-actions Bot added refactor documentation Improvements or additions to documentation router labels Sep 3, 2026
@ishandhanani

Copy link
Copy Markdown
Owner Author

Router e2e on this head (extension rebuilt from 71cea67): pytest tests/router/test_router_e2e_with_mockers.py tests/router/test_slot_tracker_e2e.py -m gpu_0 -k '<decisions, two_kv_router, decisions_disagg, disagg_startup_lifecycle, overload_529, query_instance_id, session_affinity, bidirectional_replica_lifecycle>': 25 passed, 3 failed. The 3 failures are the same environment-only ones as before the deletion (bindings built without kv-indexer and aic-forward-pass). Replica lifecycle, session affinity, overload 529 (agg + disagg, prefill-tokens + decode-blocks), disaggregated startup orderings, and routing decisions all pass with the runtime scheduler removed.

@ishandhanani

Copy link
Copy Markdown
Owner Author

DEP for this stack: #33.

@ishandhanani

Copy link
Copy Markdown
Owner Author

Superseded by #36 (the same commit rebased onto #35, plus a doc-comment placement fix). Closing.

This branch had an error being deployed

1 failed deployment
external_collaborator — 71cea67b Deployed Sep 3, 2026 by ishandhanani via ok-to-test #57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation refactor router

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant