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
e3bed74a
Unverified
Commit
e3bed74a
authored
May 18, 2025
by
Zilin Zhu
Committed by
GitHub
May 17, 2025
Browse files
[router] Add /list_workers endpoint to router (#6366)
parent
e9ef39d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
sgl-router/src/server.rs
sgl-router/src/server.rs
+8
-0
No files found.
sgl-router/src/server.rs
View file @
e3bed74a
...
@@ -132,6 +132,13 @@ async fn add_worker(
...
@@ -132,6 +132,13 @@ async fn add_worker(
}
}
}
}
#[get(
"/list_workers"
)]
async
fn
list_workers
(
data
:
web
::
Data
<
AppState
>
)
->
impl
Responder
{
let
workers
=
data
.router
.get_worker_urls
();
let
worker_list
=
workers
.read
()
.unwrap
()
.clone
();
HttpResponse
::
Ok
()
.json
(
serde_json
::
json!
({
"urls"
:
worker_list
}))
}
#[post(
"/remove_worker"
)]
#[post(
"/remove_worker"
)]
async
fn
remove_worker
(
async
fn
remove_worker
(
query
:
web
::
Query
<
HashMap
<
String
,
String
>>
,
query
:
web
::
Query
<
HashMap
<
String
,
String
>>
,
...
@@ -253,6 +260,7 @@ pub async fn startup(config: ServerConfig) -> std::io::Result<()> {
...
@@ -253,6 +260,7 @@ pub async fn startup(config: ServerConfig) -> std::io::Result<()> {
.service
(
get_server_info
)
.service
(
get_server_info
)
.service
(
add_worker
)
.service
(
add_worker
)
.service
(
remove_worker
)
.service
(
remove_worker
)
.service
(
list_workers
)
// Default handler for unmatched routes.
// Default handler for unmatched routes.
.default_service
(
web
::
route
()
.to
(
sink_handler
))
.default_service
(
web
::
route
()
.to
(
sink_handler
))
})
})
...
...
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