Repository navigation
feat(kv-router): add runtime-free selection service #10641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2a491df
feat(kv-router): add runtime-free selection service
PeaBrane 9409c1e
fix(kv-router): close select service CI gaps
PeaBrane f5bfec2
fix(ci): include selection service in runtime wheel
PeaBrane ba0ed3f
fix(bindings): import select service router config
PeaBrane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| from dynamo.select_service.main import main | ||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import sys | ||
| from collections.abc import Sequence | ||
|
|
||
| from dynamo.llm import run_select_service | ||
|
|
||
|
|
||
| def main(argv: Sequence[str] | None = None) -> int: | ||
| args = list(sys.argv[1:] if argv is None else argv) | ||
| try: | ||
| run_select_service(args) | ||
| except Exception as exc: | ||
| if "-h" in args or "--help" in args: | ||
| print(exc) | ||
| return 0 | ||
| raise | ||
| return 0 | ||
|
PeaBrane marked this conversation as resolved.
Resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| # Dynamo Selection Service | ||
|
|
||
| `dynamo-select-service` is a runtime-free HTTP service built on `dynamo-kv-router`. | ||
| It selects workers and tracks reservations, but it never forwards model requests | ||
| and never owns model responses. | ||
|
|
||
| ## Readiness | ||
|
|
||
| - `GET /health` returns process liveness. | ||
| - `GET /ready` returns `200` only after at least one worker is schedulable. | ||
| - `GET /ready` returns `503` with worker lifecycle details while no workers are schedulable. | ||
| - `/select`, `/select_and_reserve`, `/reservations`, `/potential_loads`, and | ||
| `/overlap_scores` return `503` while the target worker pool is not ready. | ||
|
|
||
| ## Worker Lifecycle | ||
|
|
||
| Workers are accepted into a single `WorkerCatalog` and become schedulable only | ||
| after the reconciler has published consistent derived state to the scheduler, | ||
| slot tracker, and indexer/listener view. | ||
|
|
||
| Lifecycle values: | ||
|
|
||
| - `incomplete`: accepted, but missing metadata required for valid booking. | ||
| - `schedulable`: metadata is complete and the scheduler can safely book it. | ||
| - `draining`: removed from the scheduler view before cleanup. | ||
| - `unschedulable`: cleanup has completed and the worker is no longer selectable. | ||
|
|
||
| When queueing is enabled, `max_num_batched_tokens` is required before a worker | ||
| can become schedulable. When KV events are enabled, KV event listener endpoints | ||
| are also required. | ||
|
|
||
| ## Selection APIs | ||
|
|
||
| ### `POST /select` | ||
|
|
||
| Selects a worker through the existing `SchedulerQueue` admission path with | ||
| `update_states=false`. | ||
|
|
||
| This endpoint is query-only. It does not book active-load state. If | ||
| `selection_id` is provided, the service accepts and echoes it for observability, | ||
| but it does not dedupe, replay, or otherwise make retries idempotent. Retrying | ||
| `/select` may produce a fresh selection. | ||
|
|
||
| ### `POST /select_and_reserve` | ||
|
|
||
| Selects a worker through the same `SchedulerQueue` admission path and books | ||
| active-load state before returning. | ||
|
|
||
| `reservation_id` is used as the scheduler and slot-tracker request ID. If it is | ||
| omitted, the service generates one. Duplicate IDs use the existing slot-tracker | ||
| behavior and may return `409 Conflict`; V1 does not provide retry idempotency, | ||
| distributed atomicity, or exactly-once booking semantics. | ||
|
|
||
| ### `POST /reservations` | ||
|
|
||
| Books an explicit post-select reservation on the supplied worker and dp-rank. | ||
| `reservation_id` is the booking request ID. Duplicate IDs use existing | ||
| slot-tracker behavior and may return `409 Conflict`. | ||
|
|
||
| Clients must treat reservation creation as at-most-once unless they can tolerate | ||
| duplicate/conflict handling. | ||
|
|
||
| ### Lifecycle | ||
|
|
||
| - `POST /reservations/{reservation_id}/prefill_complete` | ||
| - `DELETE /reservations/{reservation_id}` | ||
|
|
||
| Lifecycle endpoints operate on `reservation_id`. | ||
|
|
||
| ## Request Inputs | ||
|
|
||
| For `/select`, `/select_and_reserve`, `/potential_loads`, and `/overlap_scores`: | ||
|
|
||
| - If `token_ids` is present, the service computes block hashes and sequence | ||
| hashes internally and ignores supplied hashes. `isl_tokens` is derived from | ||
| `token_ids.len()`. | ||
| - Otherwise, callers must provide `block_hashes`, `sequence_hashes`, and | ||
| `isl_tokens`. | ||
|
|
||
| For `POST /reservations`: | ||
|
|
||
| - If `token_ids` is present, the service computes sequence hashes internally. | ||
| - Otherwise, callers must provide `sequence_hashes` and `isl_tokens`. | ||
|
|
||
| Signed hash values are reinterpreted bit-for-bit as unsigned router hashes, | ||
| matching the standalone indexer and slot-tracker APIs. | ||
|
|
||
| ## Retry Semantics | ||
|
|
||
| V1 intentionally has no internal idempotency ledger. | ||
|
|
||
| - `/select` retries may return a different worker. | ||
| - `/select_and_reserve` retries with the same `reservation_id` may return | ||
| `409 Conflict` if the first booking succeeded. | ||
| - `POST /reservations` retries with the same `reservation_id` may return | ||
| `409 Conflict` if the first booking succeeded. | ||
| - Clients that need replayable retry semantics should keep their own request | ||
| ledger. The service core is structured so a core idempotency ledger can be | ||
| added later without changing the scheduler queue contract. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.