Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
6e95f5e5
Unverified
Commit
6e95f5e5
authored
Sep 05, 2025
by
Liangsheng Yin
Committed by
GitHub
Sep 05, 2025
Browse files
Simplify `Router` arguments passing and build it in docker image (#9964)
parent
0e9387a9
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
27 deletions
+50
-27
sgl-router/setup.py
sgl-router/setup.py
+21
-0
test/srt/test_disaggregation.py
test/srt/test_disaggregation.py
+17
-17
test/srt/test_disaggregation_different_tp.py
test/srt/test_disaggregation_different_tp.py
+9
-9
test/srt/test_disaggregation_pp.py
test/srt/test_disaggregation_pp.py
+3
-1
No files found.
sgl-router/setup.py
0 → 100644
View file @
6e95f5e5
import
os
from
setuptools
import
setup
from
setuptools_rust
import
Binding
,
RustExtension
no_rust
=
os
.
environ
.
get
(
"SGLANG_ROUTER_BUILD_NO_RUST"
)
==
"1"
rust_extensions
=
[]
if
not
no_rust
:
rust_extensions
.
append
(
RustExtension
(
target
=
"sglang_router_rs"
,
path
=
"Cargo.toml"
,
binding
=
Binding
.
PyO3
,
)
)
setup
(
rust_extensions
=
rust_extensions
,
zip_safe
=
False
,
)
test/srt/test_disaggregation.py
View file @
6e95f5e5
import
json
import
json
import
os
import
os
import
subprocess
import
time
import
time
import
unittest
import
unittest
from
types
import
SimpleNamespace
from
types
import
SimpleNamespace
...
@@ -18,6 +17,7 @@ from sglang.test.test_utils import (
...
@@ -18,6 +17,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST
,
DEFAULT_URL_FOR_TEST
,
CustomTestCase
,
CustomTestCase
,
popen_launch_pd_server
,
popen_launch_pd_server
,
popen_with_error_check
,
)
)
...
@@ -47,7 +47,9 @@ class TestDisaggregationAccuracy(CustomTestCase):
...
@@ -47,7 +47,9 @@ class TestDisaggregationAccuracy(CustomTestCase):
lb_command
=
[
lb_command
=
[
"python3"
,
"python3"
,
"-m"
,
"-m"
,
"sglang.srt.disaggregation.mini_lb"
,
"sglang_router.launch_router"
,
"--pd-disaggregation"
,
"--mini-lb"
,
# FIXME: remove this
"--prefill"
,
"--prefill"
,
cls
.
prefill_url
,
cls
.
prefill_url
,
"--decode"
,
"--decode"
,
...
@@ -59,9 +61,7 @@ class TestDisaggregationAccuracy(CustomTestCase):
...
@@ -59,9 +61,7 @@ class TestDisaggregationAccuracy(CustomTestCase):
]
]
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
cls
.
process_lb
=
subprocess
.
Popen
(
cls
.
process_lb
=
popen_with_error_check
(
lb_command
)
lb_command
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
@
classmethod
@
classmethod
...
@@ -228,7 +228,9 @@ class TestDisaggregationMooncakeFailure(CustomTestCase):
...
@@ -228,7 +228,9 @@ class TestDisaggregationMooncakeFailure(CustomTestCase):
lb_command
=
[
lb_command
=
[
"python3"
,
"python3"
,
"-m"
,
"-m"
,
"sglang.srt.disaggregation.mini_lb"
,
"sglang_router.launch_router"
,
"--pd-disaggregation"
,
"--mini-lb"
,
# FIXME: remove this
"--prefill"
,
"--prefill"
,
cls
.
prefill_url
,
cls
.
prefill_url
,
"--decode"
,
"--decode"
,
...
@@ -240,9 +242,7 @@ class TestDisaggregationMooncakeFailure(CustomTestCase):
...
@@ -240,9 +242,7 @@ class TestDisaggregationMooncakeFailure(CustomTestCase):
]
]
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
cls
.
process_lb
=
subprocess
.
Popen
(
cls
.
process_lb
=
popen_with_error_check
(
lb_command
)
lb_command
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
@
classmethod
@
classmethod
...
@@ -383,7 +383,9 @@ class TestDisaggregationMooncakeSpec(CustomTestCase):
...
@@ -383,7 +383,9 @@ class TestDisaggregationMooncakeSpec(CustomTestCase):
lb_command
=
[
lb_command
=
[
"python3"
,
"python3"
,
"-m"
,
"-m"
,
"sglang.srt.disaggregation.mini_lb"
,
"sglang_router.launch_router"
,
"--pd-disaggregation"
,
"--mini-lb"
,
# FIXME: remove this
"--prefill"
,
"--prefill"
,
cls
.
prefill_url
,
cls
.
prefill_url
,
"--decode"
,
"--decode"
,
...
@@ -395,9 +397,7 @@ class TestDisaggregationMooncakeSpec(CustomTestCase):
...
@@ -395,9 +397,7 @@ class TestDisaggregationMooncakeSpec(CustomTestCase):
]
]
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
cls
.
process_lb
=
subprocess
.
Popen
(
cls
.
process_lb
=
popen_with_error_check
(
lb_command
)
lb_command
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
@
classmethod
@
classmethod
...
@@ -509,7 +509,9 @@ class TestDisaggregationSimulatedRetract(CustomTestCase):
...
@@ -509,7 +509,9 @@ class TestDisaggregationSimulatedRetract(CustomTestCase):
lb_command
=
[
lb_command
=
[
"python3"
,
"python3"
,
"-m"
,
"-m"
,
"sglang.srt.disaggregation.mini_lb"
,
"sglang_router.launch_router"
,
"--pd-disaggregation"
,
"--mini-lb"
,
# FIXME: remove this
"--prefill"
,
"--prefill"
,
cls
.
prefill_url
,
cls
.
prefill_url
,
"--decode"
,
"--decode"
,
...
@@ -521,9 +523,7 @@ class TestDisaggregationSimulatedRetract(CustomTestCase):
...
@@ -521,9 +523,7 @@ class TestDisaggregationSimulatedRetract(CustomTestCase):
]
]
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
cls
.
process_lb
=
subprocess
.
Popen
(
cls
.
process_lb
=
popen_with_error_check
(
lb_command
)
lb_command
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
@
classmethod
@
classmethod
...
...
test/srt/test_disaggregation_different_tp.py
View file @
6e95f5e5
...
@@ -15,7 +15,7 @@ from sglang.test.test_utils import (
...
@@ -15,7 +15,7 @@ from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST
,
DEFAULT_URL_FOR_TEST
,
CustomTestCase
,
CustomTestCase
,
popen_launch_pd_server
,
popen_launch_pd_server
,
ru
n_with_
timeout
,
pope
n_with_
error_check
,
)
)
...
@@ -49,7 +49,9 @@ class TestDisaggregationMooncakePrefillLargerTP(CustomTestCase):
...
@@ -49,7 +49,9 @@ class TestDisaggregationMooncakePrefillLargerTP(CustomTestCase):
lb_command
=
[
lb_command
=
[
"python3"
,
"python3"
,
"-m"
,
"-m"
,
"sglang.srt.disaggregation.mini_lb"
,
"sglang_router.launch_router"
,
"--pd-disaggregation"
,
"--mini-lb"
,
# FIXME: remove this
"--prefill"
,
"--prefill"
,
cls
.
prefill_url
,
cls
.
prefill_url
,
"--decode"
,
"--decode"
,
...
@@ -61,9 +63,7 @@ class TestDisaggregationMooncakePrefillLargerTP(CustomTestCase):
...
@@ -61,9 +63,7 @@ class TestDisaggregationMooncakePrefillLargerTP(CustomTestCase):
]
]
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
cls
.
process_lb
=
subprocess
.
Popen
(
cls
.
process_lb
=
popen_with_error_check
(
lb_command
)
lb_command
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
@
classmethod
@
classmethod
...
@@ -183,7 +183,9 @@ class TestDisaggregationMooncakeDecodeLargerTP(CustomTestCase):
...
@@ -183,7 +183,9 @@ class TestDisaggregationMooncakeDecodeLargerTP(CustomTestCase):
lb_command
=
[
lb_command
=
[
"python3"
,
"python3"
,
"-m"
,
"-m"
,
"sglang.srt.disaggregation.mini_lb"
,
"sglang_router.launch_router"
,
"--pd-disaggregation"
,
"--mini-lb"
,
# FIXME: remove this
"--prefill"
,
"--prefill"
,
cls
.
prefill_url
,
cls
.
prefill_url
,
"--decode"
,
"--decode"
,
...
@@ -195,9 +197,7 @@ class TestDisaggregationMooncakeDecodeLargerTP(CustomTestCase):
...
@@ -195,9 +197,7 @@ class TestDisaggregationMooncakeDecodeLargerTP(CustomTestCase):
]
]
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
print
(
"Starting load balancer:"
,
" "
.
join
(
lb_command
))
cls
.
process_lb
=
subprocess
.
Popen
(
cls
.
process_lb
=
popen_with_error_check
(
lb_command
)
lb_command
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
cls
.
wait_server_ready
(
cls
.
lb_url
+
"/health"
)
@
classmethod
@
classmethod
...
...
test/srt/test_disaggregation_pp.py
View file @
6e95f5e5
...
@@ -49,7 +49,9 @@ class TestPDPPAccuracy(unittest.TestCase):
...
@@ -49,7 +49,9 @@ class TestPDPPAccuracy(unittest.TestCase):
lb_command
=
[
lb_command
=
[
"python3"
,
"python3"
,
"-m"
,
"-m"
,
"sglang.srt.disaggregation.mini_lb"
,
"sglang_router.launch_router"
,
"--pd-disaggregation"
,
"--mini-lb"
,
# FIXME: remove this
"--prefill"
,
"--prefill"
,
cls
.
prefill_url
,
cls
.
prefill_url
,
"--decode"
,
"--decode"
,
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment