"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "89c79bec8cf7a7b04f761fcc5306d2edf47a4164"
Unverified Commit 1f09e84b authored by SangBin Cho's avatar SangBin Cho Committed by GitHub
Browse files

nit: Remove busy waiting on scheduler (#2382)

parent 63dfab1b
# Contributor Guide # Contributor Guide
# Build SGLang
See [Install SGLang, Method 2: From Source section](../start/install.md).
## Format Your Code ## Format Your Code
Use these commands to format your code and pass CI linting tests. Use these commands to format your code and pass CI linting tests.
......
...@@ -13,7 +13,7 @@ classifiers = [ ...@@ -13,7 +13,7 @@ classifiers = [
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License", "License :: OSI Approved :: Apache Software License",
] ]
dependencies = ["requests", "tqdm", "numpy", "IPython"] dependencies = ["requests", "tqdm", "numpy", "IPython", "setproctitle"]
[project.optional-dependencies] [project.optional-dependencies]
runtime_common = ["aiohttp", "decord", "fastapi", runtime_common = ["aiohttp", "decord", "fastapi",
......
...@@ -20,6 +20,7 @@ from collections import OrderedDict ...@@ -20,6 +20,7 @@ from collections import OrderedDict
from typing import List, Union from typing import List, Union
import psutil import psutil
import setproctitle
import zmq import zmq
from sglang.srt.hf_transformers_utils import get_tokenizer from sglang.srt.hf_transformers_utils import get_tokenizer
...@@ -194,6 +195,7 @@ def run_detokenizer_process( ...@@ -194,6 +195,7 @@ def run_detokenizer_process(
server_args: ServerArgs, server_args: ServerArgs,
port_args: PortArgs, port_args: PortArgs,
): ):
setproctitle.setproctitle("sglang::detokenizer")
configure_logger(server_args) configure_logger(server_args)
parent_process = psutil.Process().parent() parent_process = psutil.Process().parent()
......
...@@ -25,6 +25,7 @@ from types import SimpleNamespace ...@@ -25,6 +25,7 @@ from types import SimpleNamespace
from typing import List, Optional from typing import List, Optional
import psutil import psutil
import setproctitle
import torch import torch
import zmq import zmq
...@@ -439,6 +440,10 @@ class Scheduler: ...@@ -439,6 +440,10 @@ class Scheduler:
if self.tp_rank == 0 or self.server_args.enable_dp_attention: if self.tp_rank == 0 or self.server_args.enable_dp_attention:
recv_reqs = [] recv_reqs = []
if self.last_batch is None:
recv_req = self.recv_from_tokenizer.recv_pyobj()
recv_reqs.append(recv_req)
else:
while True: while True:
try: try:
recv_req = self.recv_from_tokenizer.recv_pyobj(zmq.NOBLOCK) recv_req = self.recv_from_tokenizer.recv_pyobj(zmq.NOBLOCK)
...@@ -1473,6 +1478,8 @@ def run_scheduler_process( ...@@ -1473,6 +1478,8 @@ def run_scheduler_process(
dp_rank: Optional[int], dp_rank: Optional[int],
pipe_writer, 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 # [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: if dp_rank is None and "SGLANG_DP_RANK" in os.environ:
dp_rank = int(os.environ["SGLANG_DP_RANK"]) dp_rank = int(os.environ["SGLANG_DP_RANK"])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment