Skip to content

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

Closed
ishandhanani wants to merge 1 commit into
idhanani/s1a-embedded-parityfrom
idhanani/s1a-delete-kvscheduler
Closed

ishandhanani wants to merge 1 commit into
idhanani/s1a-embedded-parityfrom
idhanani/s1a-delete-kvscheduler

Conversation

@ishandhanani

Copy link
Copy Markdown
Owner

Stack 1, group A, step 2 of the unification DEP (#33, "Stack 1 DEP r2" comment). Stacked on #35.

Summary

One logical change: delete the runtime-bound KvScheduler now that the embedded selection partition has parity (#35). The frontend router always schedules on the partition.

  • lib/llm/src/kv_router/scheduler.rs keeps only its runtime-free re-exports; sequence.rs loses the runtime sequence publisher and its constructors; the direct-ZMQ active-sequence ingress (sequence/direct_zmq.rs) and the two-variant RouterScheduler dispatch macro are gone; the LoRA load estimator's uncalled scheduler polling is removed.
  • KvRouter<Sel> keeps its type parameter for source compatibility (PhantomData<fn() -> Sel>). A caller-injected WorkerSelector<ModelRuntimeConfig> that is neither the default selector nor a registry WorkerSelectionPolicy runs inside the partition through WorkerSelectionPolicy::delegated (new DelegatedWorkerSelector trait and ErasedWorkerConfig in dynamo-kv-router). The existing fake-selector unit tests run unchanged on that path.
  • router_embedded_selection is deprecated and ignored; false logs a warning. The router_worker_registered gauge moves to the embedded catalog feeder.

Net: 381 insertions, 2096 deletions. Same change as #31 rebased onto #35; #31 will be closed pointing here.

Validation

  • cargo test -p dynamo-kv-router --lib: 949 passed.
  • cargo test -p dynamo-llm --lib -- kv_router:: lora::: 465 passed.
  • cargo clippy -p dynamo-llm -p dynamo-kv-router --tests: clean. Bindings crate cargo check: clean.
  • On refactor(router): delete the runtime-bound KV router scheduler #31 (same code, before rebase): tests/router/test_router_e2e_with_mockers.py -m gpu_0: 25 passed, 3 environment-only failures (kv-indexer / aic features not built); replay byte parity vs main on 4 rows.

Review notes (graham-code-review pass)

  • Fixed during review: WorkerSelectionPolicy::delegated had been inserted between new_with_filters and its doc comment, so the docs attached to the wrong function.
  • Transitional cost: the delegated path builds an ErasedWorkerConfig map and then a ModelRuntimeConfig map per selection. Only custom Sel callers (tests today) pay it. The next step drops the Sel generic and this adapter entirely, so it is not optimized here.
  • The TypeId comparison that decides whether a Sel needs the delegating policy is the same transitional shape and goes with it.

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]>
(cherry picked from commit 71cea67)
@ishandhanani

Copy link
Copy Markdown
Owner Author

Superseded by the upstream-shaped staging stack: continued as #48 (rebased onto ai-dynamo/main, see #33).

This branch had an error being deployed

1 failed deployment
external_collaborator — f3515781 Deployed Sep 3, 2026 by ishandhanani via ok-to-test #61
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