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
565b05f0
Unverified
Commit
565b05f0
authored
Oct 06, 2024
by
Byron Hsu
Committed by
GitHub
Oct 07, 2024
Browse files
Use `atexit` hook to implicitly shutdown `Runtime` (#1595)
parent
b6aad70a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
python/sglang/srt/server.py
python/sglang/srt/server.py
+3
-0
No files found.
python/sglang/srt/server.py
View file @
565b05f0
...
@@ -514,6 +514,9 @@ class Runtime:
...
@@ -514,6 +514,9 @@ class Runtime:
"""See the arguments in server_args.py::ServerArgs"""
"""See the arguments in server_args.py::ServerArgs"""
self
.
server_args
=
ServerArgs
(
*
args
,
log_level
=
log_level
,
**
kwargs
)
self
.
server_args
=
ServerArgs
(
*
args
,
log_level
=
log_level
,
**
kwargs
)
# before python program terminates, call shutdown implicitly. Therefore, users don't have to explicitly call .shutdown()
atexit
.
register
(
self
.
shutdown
)
# Pre-allocate ports
# Pre-allocate ports
for
port
in
range
(
10000
,
40000
):
for
port
in
range
(
10000
,
40000
):
if
is_port_available
(
port
):
if
is_port_available
(
port
):
...
...
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