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
8cc300f5
Unverified
Commit
8cc300f5
authored
Mar 16, 2025
by
Byron Hsu
Committed by
GitHub
Mar 16, 2025
Browse files
Fix router test (#4483)
parent
452db508
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
20 deletions
+21
-20
python/sglang/test/test_utils.py
python/sglang/test/test_utils.py
+8
-1
sgl-router/py_test/run_suite.py
sgl-router/py_test/run_suite.py
+3
-2
sgl-router/src/router.rs
sgl-router/src/router.rs
+9
-8
test/lang/run_suite.py
test/lang/run_suite.py
+1
-9
No files found.
python/sglang/test/test_utils.py
View file @
8cc300f5
...
...
@@ -10,6 +10,7 @@ import threading
import
time
import
unittest
from
concurrent.futures
import
ThreadPoolExecutor
from
dataclasses
import
dataclass
from
functools
import
partial
from
types
import
SimpleNamespace
from
typing
import
Callable
,
List
,
Optional
,
Tuple
...
...
@@ -453,7 +454,13 @@ def run_with_timeout(
return
ret_value
[
0
]
def
run_unittest_files
(
files
:
List
,
timeout_per_file
:
float
):
@
dataclass
class
TestFile
:
name
:
str
estimated_time
:
float
=
60
def
run_unittest_files
(
files
:
List
[
TestFile
],
timeout_per_file
:
float
):
tic
=
time
.
time
()
success
=
True
...
...
sgl-router/py_test/run_suite.py
View file @
8cc300f5
import
argparse
import
glob
from
sglang.test.test_utils
import
run_unittest_files
from
sglang.test.test_utils
import
TestFile
,
run_unittest_files
if
__name__
==
"__main__"
:
arg_parser
=
argparse
.
ArgumentParser
()
...
...
@@ -15,5 +15,6 @@ if __name__ == "__main__":
files
=
glob
.
glob
(
"**/test_*.py"
,
recursive
=
True
)
exit_code
=
run_unittest_files
(
files
,
args
.
timeout_per_file
)
test_files
=
[
TestFile
(
name
=
file
)
for
file
in
files
]
exit_code
=
run_unittest_files
(
test_files
,
args
.
timeout_per_file
)
exit
(
exit_code
)
sgl-router/src/router.rs
View file @
8cc300f5
...
...
@@ -267,19 +267,20 @@ impl Router {
match
sync_client
.get
(
&
format!
(
"{}/health"
,
url
))
.send
()
{
Ok
(
res
)
=>
{
if
!
res
.status
()
.is_success
()
{
info!
(
"Worker {} health check is pending with status: {}."
,
url
,
let
msg
=
format!
(
"Worker heatlh check is pending with status {}"
,
res
.status
()
);
info!
(
"{}"
,
msg
);
all_healthy
=
false
;
unhealthy_workers
.push
((
url
,
format!
(
"Status: {}"
,
res
.status
())
));
unhealthy_workers
.push
((
url
,
msg
));
}
}
Err
(
e
)
=>
{
info!
(
"Worker {} health check is pending with error: {}"
,
url
,
e
);
Err
(
_
)
=>
{
let
msg
=
format!
(
"Worker is not ready yet"
);
info!
(
"{}"
,
msg
);
all_healthy
=
false
;
unhealthy_workers
.push
((
url
,
format!
(
"Error: {}"
,
e
)
));
unhealthy_workers
.push
((
url
,
msg
));
}
}
}
...
...
@@ -288,7 +289,7 @@ impl Router {
info!
(
"All workers are healthy"
);
return
Ok
(());
}
else
{
info!
(
"
Unhealthy
workers:"
);
info!
(
"
Initializing
workers:"
);
for
(
url
,
reason
)
in
&
unhealthy_workers
{
info!
(
" {} - {}"
,
url
,
reason
);
}
...
...
test/lang/run_suite.py
View file @
8cc300f5
import
argparse
import
glob
from
dataclasses
import
dataclass
from
sglang.test.test_utils
import
run_unittest_files
@
dataclass
class
TestFile
:
name
:
str
estimated_time
:
float
=
60
from
sglang.test.test_utils
import
TestFile
,
run_unittest_files
suites
=
{
"per-commit"
:
[
...
...
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