Clean up server args and engine startup processes (#15015)

This commit is contained in:
Lianmin Zheng
2025-12-12 18:46:07 -08:00
committed by GitHub
parent 313f59ad80
commit 267170bf1d
7 changed files with 105 additions and 81 deletions

View File

@@ -76,7 +76,6 @@ from sglang.srt.utils import (
launch_dummy_health_check_server,
maybe_reindex_device_id,
numa_utils,
prepare_model_and_tokenizer,
set_prometheus_multiproc_dir,
set_ulimit,
)
@@ -105,11 +104,6 @@ def _launch_subprocesses(
port_args = PortArgs.init_new(server_args)
logger.info(f"{server_args=}")
# If using model from www.modelscope.cn, first download the model
server_args.model_path, server_args.tokenizer_path = prepare_model_and_tokenizer(
server_args.model_path, server_args.tokenizer_path
)
# Launch scheduler processes
scheduler_procs, scheduler_pipe_readers = _launch_scheduler_processes(
server_args=server_args,
@@ -826,22 +820,23 @@ def _set_envs_and_config(server_args: ServerArgs):
set_ulimit()
# Check flashinfer version
if server_args.attention_backend == "flashinfer":
assert_pkg_version(
"flashinfer_python",
"0.5.3",
"Please uninstall the old version and "
"reinstall the latest version by following the instructions "
"at https://docs.flashinfer.ai/installation.html.",
)
if _is_cuda and not get_bool_env_var("SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK"):
assert_pkg_version(
"sgl-kernel",
"0.3.19",
"Please reinstall the latest version with `pip install sgl-kernel --force-reinstall`",
)
if not get_bool_env_var("SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK"):
if server_args.attention_backend == "flashinfer":
assert_pkg_version(
"flashinfer_python",
"0.5.3",
"Please uninstall the old version and "
"reinstall the latest version by following the instructions "
"at https://docs.flashinfer.ai/installation.html.",
)
if _is_cuda:
assert_pkg_version(
"sgl-kernel",
"0.3.19",
"Please reinstall the latest version with `pip install sgl-kernel --force-reinstall`",
)
if True: # Keep this check for internal code compatibility
if server_args.custom_sigquit_handler is None:
# Register the signal handler.
# The child processes will send SIGQUIT to this process when any error happens
# This process then clean up the whole process tree
@@ -854,6 +849,12 @@ def _set_envs_and_config(server_args: ServerArgs):
kill_process_tree(os.getpid())
signal.signal(signal.SIGQUIT, launch_phase_sigquit_handler)
else:
# Allow users to register a custom SIGQUIT handler for things like crash dump
logger.error(
f"Using custom SIGQUIT handler: {server_args.custom_sigquit_handler}"
)
signal.signal(signal.SIGQUIT, server_args.custom_sigquit_handler)
# Set mp start method
mp.set_start_method("spawn", force=True)