Repository navigation
Keep a router's existing registration when an engine registers again - #2483
Merged
Merged
Conversation
An external engine (--rollout-external-engine-addrs) is registered with the router on every run, and shutdown() leaves it registered because the external cluster owns it. A run that ends uncleanly leaves its engines registered too. A router whose POST /workers is create-only, such as SMG, answers the next run's POST with 409 WORKER_ALREADY_EXISTS, and raise_for_status() aborts that run. register_worker() now keeps the router's registration when the 409 says WORKER_ALREADY_EXISTS and GET /workers lists that URL with the same payload (worker_type, and bootstrap_port for prefill). Any other refusal, including a registration that differs, is still raised. Signed-off-by: Keyang Ru <rukeyang@gmail.com>
Contributor
Author
|
@zhuzilin could you take a look when you have a moment? With The CPU tests are in |
Signed-off-by: Keyang Ru <rukeyang@gmail.com>
Contributor
|
sorry for the late reply. thank you so much for the PR! |
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.
Problem
With external engines (
--rollout-external-engine-addrs), slime registers each engine with the router on every run (_init_external→_register_to_router).shutdown()returns beforeunregister_worker, because the external cluster owns those processes. So the engines stay registered after the run, which is intended: they outlive it. A run that ends uncleanly leaves its launched engines registered the same way.The next run POSTs the same URLs again.
sglang_router0.3.2 answers a repeat with 202, so this goes unnoticed with the default router. A router whosePOST /workersis create-only answers409 WORKER_ALREADY_EXISTS, andraise_for_status()aborts the run before its first rollout. One such router is SMG, whosePOST /workersstays create-only (smg-project/smg#3976 was declined).Reproduced with two engines served outside slime, SMG as the router, and two short runs back to back:
Fix
Registration goes through a new
server_control.register_worker(), next tounregister_worker().409withcode: WORKER_ALREADY_EXISTS, it readsGET /workers. If the router lists the URL with the same payload slime would post (url,worker_type, andbootstrap_portfor a prefill engine), it keeps that registration and logs it.WORKER_CREATE_IN_PROGRESS, or another status.Routers that answer 2xx, including
sglang_router, see no change.Tests
tests/test_server_control.py, CPU-only, with a fake router:test_register_worker_posts_the_payload: 200 and 202;test_register_worker_keeps_the_registration_an_earlier_run_left: a matching prefill registration with itsbootstrap_port;test_register_worker_refuses_a_registration_that_differs: another worker type, another or missingbootstrap_port;test_register_worker_raises_any_other_refusal: another 409 code, a 409 without a code, a 500.End to end on 4x H100: two engines served outside slime (
--rollout-external-engine-addrs), Qwen3-0.6B, SMG as the router, and two 3-step runs back to back against the same router. The patch was cherry-picked onto5bec7a10;slime/backends/sglang_utils/is unchanged between that commit andmain.