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
c33499a6
Unverified
Commit
c33499a6
authored
Jul 22, 2025
by
Rui Chen
Committed by
GitHub
Jul 22, 2025
Browse files
fix: sgl-router remove dead code (#8257)
parent
e50109f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
76 deletions
+0
-76
sgl-router/src/routers/router.rs
sgl-router/src/routers/router.rs
+0
-76
No files found.
sgl-router/src/routers/router.rs
View file @
c33499a6
...
...
@@ -283,82 +283,6 @@ impl Router {
HttpResponse
::
InternalServerError
()
.body
(
"All retry attempts failed"
)
}
pub
async
fn
route_to_all
(
&
self
,
client
:
&
reqwest
::
Client
,
route
:
&
str
,
req
:
&
HttpRequest
,
)
->
HttpResponse
{
// Get all worker URLs
let
worker_urls
=
self
.get_worker_urls
();
// Send requests to all workers concurrently
let
mut
tasks
=
Vec
::
new
();
for
worker_url
in
&
worker_urls
{
let
mut
request_builder
=
client
.post
(
format!
(
"{}{}"
,
worker_url
,
route
));
// Copy headers from original request
for
(
name
,
value
)
in
copy_request_headers
(
req
)
{
request_builder
=
request_builder
.header
(
name
,
value
);
}
tasks
.push
(
request_builder
.send
());
}
// Wait for all responses
let
results
=
futures_util
::
future
::
join_all
(
tasks
)
.await
;
// Check if all succeeded
let
all_success
=
results
.iter
()
.all
(|
r
|
{
r
.as_ref
()
.map
(|
res
|
res
.status
()
.is_success
())
.unwrap_or
(
false
)
});
if
all_success
{
HttpResponse
::
Ok
()
.body
(
"Operation completed on all servers"
)
}
else
{
HttpResponse
::
InternalServerError
()
.body
(
"Operation failed on one or more servers"
)
}
}
pub
async
fn
get_all_loads
(
&
self
,
client
:
&
reqwest
::
Client
,
_
req
:
&
HttpRequest
,
)
->
HttpResponse
{
let
urls
=
self
.get_worker_urls
();
let
prefill_urls
:
Vec
<
String
>
=
Vec
::
new
();
let
decode_urls
=
urls
;
// Collect loads from all servers
let
mut
prefill_loads
=
Vec
::
new
();
let
mut
decode_loads
=
Vec
::
new
();
// Get prefill loads
for
url
in
&
prefill_urls
{
let
load
=
self
.get_worker_load
(
client
,
url
)
.await
.unwrap_or
(
-
1
);
prefill_loads
.push
(
serde_json
::
json!
({
"engine"
:
format!
(
"(Prefill@{})"
,
url
),
"load"
:
load
as
i64
}));
}
// Get decode loads
for
url
in
&
decode_urls
{
let
load
=
self
.get_worker_load
(
client
,
url
)
.await
.unwrap_or
(
-
1
);
decode_loads
.push
(
serde_json
::
json!
({
"engine"
:
format!
(
"(Decode@{})"
,
url
),
"load"
:
load
as
i64
}));
}
HttpResponse
::
Ok
()
.json
(
serde_json
::
json!
({
"prefill"
:
prefill_loads
,
"decode"
:
decode_loads
}))
}
// New method to route typed requests directly
pub
async
fn
route_typed_request
<
T
:
crate
::
openai_api_types
::
GenerationRequest
+
serde
::
Serialize
+
Clone
,
...
...
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