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
1f09e84b
Unverified
Commit
1f09e84b
authored
Dec 08, 2024
by
SangBin Cho
Committed by
GitHub
Dec 08, 2024
Browse files
nit: Remove busy waiting on scheduler (#2382)
parent
63dfab1b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
6 deletions
+19
-6
docs/references/contributor_guide.md
docs/references/contributor_guide.md
+4
-0
python/pyproject.toml
python/pyproject.toml
+1
-1
python/sglang/srt/managers/detokenizer_manager.py
python/sglang/srt/managers/detokenizer_manager.py
+2
-0
python/sglang/srt/managers/scheduler.py
python/sglang/srt/managers/scheduler.py
+12
-5
No files found.
docs/references/contributor_guide.md
View file @
1f09e84b
# Contributor Guide
# Build SGLang
See
[
Install SGLang, Method 2: From Source section
](
../start/install.md
)
.
## Format Your Code
Use these commands to format your code and pass CI linting tests.
...
...
python/pyproject.toml
View file @
1f09e84b
...
...
@@ -13,7 +13,7 @@ classifiers = [
"Programming Language :: Python :: 3"
,
"License :: OSI Approved :: Apache Software License"
,
]
dependencies
=
[
"requests"
,
"tqdm"
,
"numpy"
,
"IPython"
]
dependencies
=
[
"requests"
,
"tqdm"
,
"numpy"
,
"IPython"
,
"setproctitle"
]
[project.optional-dependencies]
runtime_common
=
[
"aiohttp"
,
"decord"
,
"fastapi"
,
...
...
python/sglang/srt/managers/detokenizer_manager.py
View file @
1f09e84b
...
...
@@ -20,6 +20,7 @@ from collections import OrderedDict
from
typing
import
List
,
Union
import
psutil
import
setproctitle
import
zmq
from
sglang.srt.hf_transformers_utils
import
get_tokenizer
...
...
@@ -194,6 +195,7 @@ def run_detokenizer_process(
server_args
:
ServerArgs
,
port_args
:
PortArgs
,
):
setproctitle
.
setproctitle
(
"sglang::detokenizer"
)
configure_logger
(
server_args
)
parent_process
=
psutil
.
Process
().
parent
()
...
...
python/sglang/srt/managers/scheduler.py
View file @
1f09e84b
...
...
@@ -25,6 +25,7 @@ from types import SimpleNamespace
from
typing
import
List
,
Optional
import
psutil
import
setproctitle
import
torch
import
zmq
...
...
@@ -439,12 +440,16 @@ class Scheduler:
if
self
.
tp_rank
==
0
or
self
.
server_args
.
enable_dp_attention
:
recv_reqs
=
[]
while
True
:
try
:
recv_req
=
self
.
recv_from_tokenizer
.
recv_pyobj
(
zmq
.
NOBLOCK
)
except
zmq
.
ZMQError
:
break
if
self
.
last_batch
is
None
:
recv_req
=
self
.
recv_from_tokenizer
.
recv_pyobj
()
recv_reqs
.
append
(
recv_req
)
else
:
while
True
:
try
:
recv_req
=
self
.
recv_from_tokenizer
.
recv_pyobj
(
zmq
.
NOBLOCK
)
except
zmq
.
ZMQError
:
break
recv_reqs
.
append
(
recv_req
)
else
:
recv_reqs
=
None
...
...
@@ -1473,6 +1478,8 @@ def run_scheduler_process(
dp_rank
:
Optional
[
int
],
pipe_writer
,
):
setproctitle
.
setproctitle
(
"sglang::scheduler"
)
# [For Router] if env var "SGLANG_DP_RANK" exist, set dp_rank to the value of the env var
if
dp_rank
is
None
and
"SGLANG_DP_RANK"
in
os
.
environ
:
dp_rank
=
int
(
os
.
environ
[
"SGLANG_DP_RANK"
])
...
...
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