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
8b33d8df
You need to sign in or sign up before continuing.
Unverified
Commit
8b33d8df
authored
May 26, 2025
by
wangxiyu191
Committed by
GitHub
May 26, 2025
Browse files
[PD] Fix prefill_servers in mini_lb (#6527)
parent
e235be16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
python/sglang/srt/disaggregation/mini_lb.py
python/sglang/srt/disaggregation/mini_lb.py
+10
-3
No files found.
python/sglang/srt/disaggregation/mini_lb.py
View file @
8b33d8df
...
@@ -50,6 +50,13 @@ class MiniLoadBalancer:
...
@@ -50,6 +50,13 @@ class MiniLoadBalancer:
self
.
prefill_servers
=
[
p
.
url
for
p
in
prefill_configs
]
self
.
prefill_servers
=
[
p
.
url
for
p
in
prefill_configs
]
self
.
decode_servers
=
decode_servers
self
.
decode_servers
=
decode_servers
def
add_prefill_server
(
self
,
new_prefill_config
:
PrefillConfig
):
self
.
prefill_configs
.
append
(
new_prefill_config
)
self
.
prefill_servers
.
append
(
new_prefill_config
.
url
)
def
add_decode_server
(
self
,
new_decode_server
:
str
):
self
.
decode_servers
.
append
(
new_decode_server
)
def
select_pair
(
self
):
def
select_pair
(
self
):
# TODO: return some message instead of panic
# TODO: return some message instead of panic
assert
len
(
self
.
prefill_configs
)
>
0
,
"No prefill servers available"
assert
len
(
self
.
prefill_configs
)
>
0
,
"No prefill servers available"
...
@@ -157,7 +164,7 @@ class MiniLoadBalancer:
...
@@ -157,7 +164,7 @@ class MiniLoadBalancer:
app
=
FastAPI
()
app
=
FastAPI
()
load_balancer
=
None
load_balancer
:
Optional
[
MiniLoadBalancer
]
=
None
@
app
.
get
(
"/health"
)
@
app
.
get
(
"/health"
)
...
@@ -331,14 +338,14 @@ async def get_models():
...
@@ -331,14 +338,14 @@ async def get_models():
@
app
.
post
(
"/register"
)
@
app
.
post
(
"/register"
)
async
def
register
(
obj
:
PDRegistryRequest
):
async
def
register
(
obj
:
PDRegistryRequest
):
if
obj
.
mode
==
"prefill"
:
if
obj
.
mode
==
"prefill"
:
load_balancer
.
prefill_
configs
.
append
(
load_balancer
.
add_
prefill_
server
(
PrefillConfig
(
obj
.
registry_url
,
obj
.
bootstrap_port
)
PrefillConfig
(
obj
.
registry_url
,
obj
.
bootstrap_port
)
)
)
logger
.
info
(
logger
.
info
(
f
"Registered prefill server:
{
obj
.
registry_url
}
with bootstrap port:
{
obj
.
bootstrap_port
}
"
f
"Registered prefill server:
{
obj
.
registry_url
}
with bootstrap port:
{
obj
.
bootstrap_port
}
"
)
)
elif
obj
.
mode
==
"decode"
:
elif
obj
.
mode
==
"decode"
:
load_balancer
.
decode_server
s
.
append
(
obj
.
registry_url
)
load_balancer
.
add_
decode_server
(
obj
.
registry_url
)
logger
.
info
(
f
"Registered decode server:
{
obj
.
registry_url
}
"
)
logger
.
info
(
f
"Registered decode server:
{
obj
.
registry_url
}
"
)
else
:
else
:
raise
HTTPException
(
raise
HTTPException
(
...
...
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