feat(routing): make the three router-comparison arms declarative - #366
Draft
ishandhanani wants to merge 3 commits into
Draft
feat(routing): make the three router-comparison arms declarative#366ishandhanani wants to merge 3 commits into
ishandhanani wants to merge 3 commits into
Conversation
Adds the smallest first-class schema and renderer support needed to express three equivalent aggregate SGLang deployments in YAML, runnable through both Slurm and `srtctl apply --bash`. frontend.type: sgl-router New adapter for SGLang's experimental Rust router over a static aggregate worker pool. It builds the worker URL list, supplies the required --model-id/--tokenizer-path, and gates readiness on every advertised worker before the router's own /readyz -- which turns green after a single registration. Static discovery has no prefill/decode split, so that topology is rejected at load time. `frontend.binary` and `frontend.source` select the router executable or build it with cargo first. dynamo.policy_catalog Declares an external worker-selection policy catalog crate. The build materializes it at an immutable rev, repoints its dynamo-kv-router dependency at the checkout being built -- otherwise cargo resolves a second copy and the plugin's WorkerSelectionPolicy types no longer unify with the ones the bindings compiled against -- links it through Dynamo's custom-policy cargo feature, and publishes the crate's YAML next to the wheel for --router-policy-config. The catalog identity is folded into the wheel cache key. Requires dynamo.hash. apply --bash Now honors dynamo.sidecar, reusing the same coupled engine/sidecar supervisor as the Slurm path, and supports frontend.type: sgl-router (raw sglang.launch_server workers, no etcd/NATS/Dynamo, Tachometer scraping the serving port instead of the Dynamo system port). Also stops expand_observability from injecting Dynamo request-trace and span env into non-Dynamo frontends, which advertised artifacts nothing writes. Signed-off-by: Ishan Dhanani <[email protected]>
…arison arms Signed-off-by: Ishan Dhanani <[email protected]>
The schema and renderer support is the deliverable; the sample recipes and their walkthrough page were illustrative only. `docs/config-reference.md` already documents `frontend.type: sgl-router` and `dynamo.policy_catalog` with worked YAML, so nothing needed is lost. Test coverage is unaffected: every arm is still exercised through inline config fixtures rather than by loading shipped recipe files. Signed-off-by: Ishan Dhanani <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Makes three equivalent aggregate SGLang deployments expressible as srt-slurm YAML, runnable through both normal Slurm submission and
srtctl apply --bash. All three can serve the same model over the same two aggregate TP4 workers on one 8×H100 host under the same workload; only routing differs, and every difference is a declared field.This adds the schema and renderer support only — no sample recipes are shipped.
docs/config-reference.mddocuments both new surfaces with worked YAML.What the three arms need
1.
frontend.type: sgl-router— new adapter for SGLang's experimental Rust router (experimental/sgl-router) over a static aggregate worker pool.--worker-urlslist from the allocated topology and supplies the required--model-id/--tokenizer-path(a bare model directory is rejected by the router's tokenizer loader, so this points attokenizer.json)./healthbefore the router's/readyz, because/readyzturns green after a single registration./readyzreturns a bare status code, sowait_for_modelgained a status-only path rather than parsing an empty body.sglang.launch_server; the router discovers each worker's ZMQ KV-event publisher from/server_info, sobackend.kv_events_configis the entire event wiring — no NATS, etcd, or Dynamo runtime.frontend.binary/frontend.sourceselect the executable orcargo build --releaseit first.2. Native sidecars in the direct-host renderer —
apply --bashpreviously ignoreddynamo.sidecarand always launcheddynamo.sglang. It now emits the same coupled engine/sidecar supervisor the Slurm path uses: the sidecar starts only once the engine's gRPC port binds, either process exiting stops the other, and co-located workers get deterministic gRPC port offsets.build_sidecar_launch_commandwas split so the string-producing half is shared rather than reimplemented.3.
dynamo.policy_catalog— declares an external worker-selection policy catalog crate. Dynamo links exactly one catalog through the optionaldynamo-worker-selection-policy-catalogdependency behind thecustom-policycargo feature; this makes that link declarative. The build:dynamo-kv-routerdependency atlib/kv-routerin the checkout being built — without this, cargo resolves a second copy of that crate and the plugin'sWorkerSelectionPolicytypes no longer unify with the ones the bindings compiled against;--features custom-policy; and--router-policy-config.The catalog identity is folded into the wheel cache key so patched and unpatched builds of the same commit never collide. Requires
dynamo.hash—top_of_treehas no stable revision to build against. Not a prebuilt binary: both Slurm and direct build from source, sharing one definition of the linking contract in the stdlib-onlydirect_stages/common.py.Fields that express the difference
Holding model,
agg_nodes: 1/agg_workers: 2/gpus_per_agg: 4, engine flags,kv_events_config.aggregated: true, telemetry, and workload constant, these are the only fields that vary:frontend.typesgl-routerdynamodynamofrontend.source…/experimental/sgl-routerfrontend.argspolicy: cache_aware_zmqrouter-mode: kvrouter-mode: kvdynamo.installfalsedynamo.hash4dca1626…4dca1626…dynamo.event_planezmqzmqdynamo.sidecartruetruedynamo.policy_catalogsgl-router-cache-aware-dynamo-policy@411b4648…Arms 2 and 3 render byte-identical worker commands — asserted by a test.
Drive-by fix
expand_observabilitywas injecting DynamoDYN_REQUEST_TRACE/ span env into non-Dynamo frontends and their raw engines, advertising trace artifacts nothing writes. Now gated onfrontend.type: dynamo.Validation
srtctl dry-run,srtctl apply --bash, andbash -npass for all three arms; the rendered direct-host script is syntax-checked inside the tests.tests/test_router_comparison.py— 24 tests covering raw-router command/topology rendering, direct-host sidecar rendering and lifecycle coupling, and policy-catalog source-build/linking plus--router-policy-configplumbing. Each arm is built from an inline config fixture.ruff check/formatclean;ty checkshows no new diagnostics against baseline.Three pre-existing failures on
mainare untouched: two are macOS-only (os.sched_getaffinity), and one is a local untracked recipe using a removedobservability.scrape_metricskey.