[Frontend] Move cli_args.py and dp_supervisor.py out openai folder (#53659)

Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
This commit is contained in:
wang.yuqi
2026-08-25 07:02:32 +00:00
committed by GitHub
parent c74dd2d208
commit 735daf8ef6
14 changed files with 42 additions and 33 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ LaunchSubcommandBase = auto_mock("vllm.entrypoints.cli.launch", "LaunchSubcomman
launch_description = auto_mock("vllm.entrypoints.cli.launch", "DESCRIPTION") launch_description = auto_mock("vllm.entrypoints.cli.launch", "DESCRIPTION")
RenderSubcommand = auto_mock("vllm.entrypoints.cli.launch", "RenderSubcommand") RenderSubcommand = auto_mock("vllm.entrypoints.cli.launch", "RenderSubcommand")
sweep_subcommands = auto_mock("vllm.benchmarks.sweep.cli", "SUBCOMMANDS") sweep_subcommands = auto_mock("vllm.benchmarks.sweep.cli", "SUBCOMMANDS")
openai_cli_args = auto_mock("vllm.entrypoints.openai", "cli_args") openai_cli_args = auto_mock("vllm.entrypoints.launchers", "cli_args")
run_batch = auto_mock("vllm.entrypoints.launchers", "run_batch") run_batch = auto_mock("vllm.entrypoints.launchers", "run_batch")
if TYPE_CHECKING: if TYPE_CHECKING:
+2 -2
View File
@@ -869,7 +869,7 @@ class TestDpDeviceIdSharding:
against its inherited device-control env var.""" against its inherited device-control env var."""
import argparse import argparse
from vllm.entrypoints.openai.dp_supervisor import _build_device_ids from vllm.entrypoints.launchers.dp_supervisor import _build_device_ids
args = argparse.Namespace( args = argparse.Namespace(
tensor_parallel_size=2, pipeline_parallel_size=1, device_ids=None tensor_parallel_size=2, pipeline_parallel_size=1, device_ids=None
@@ -881,7 +881,7 @@ class TestDpDeviceIdSharding:
"""User-provided --device-ids are sharded across DP children.""" """User-provided --device-ids are sharded across DP children."""
import argparse import argparse
from vllm.entrypoints.openai.dp_supervisor import _build_device_ids from vllm.entrypoints.launchers.dp_supervisor import _build_device_ids
args = argparse.Namespace( args = argparse.Namespace(
tensor_parallel_size=2, pipeline_parallel_size=1, device_ids=[4, 5, 6, 7] tensor_parallel_size=2, pipeline_parallel_size=1, device_ids=[4, 5, 6, 7]
@@ -18,7 +18,7 @@ import typing
import pytest import pytest
from vllm.config.model import TokenizerMode from vllm.config.model import TokenizerMode
from vllm.entrypoints.openai.cli_args import BaseFrontendArgs, make_arg_parser from vllm.entrypoints.launchers.cli_args import BaseFrontendArgs, make_arg_parser
from vllm.renderers.registry import RENDERER_REGISTRY from vllm.renderers.registry import RENDERER_REGISTRY
from vllm.tokenizers.registry import TokenizerRegistry from vllm.tokenizers.registry import TokenizerRegistry
from vllm.utils.argparse_utils import FlexibleArgumentParser from vllm.utils.argparse_utils import FlexibleArgumentParser
@@ -5,12 +5,14 @@ import json
import pytest import pytest
from vllm.entrypoints.openai.cli_args import make_arg_parser, validate_parsed_serve_args from tests.utils import VLLM_PATH
from vllm.entrypoints.launchers.cli_args import (
make_arg_parser,
validate_parsed_serve_args,
)
from vllm.entrypoints.openai.models.protocol import LoRAModulePath from vllm.entrypoints.openai.models.protocol import LoRAModulePath
from vllm.utils.argparse_utils import FlexibleArgumentParser from vllm.utils.argparse_utils import FlexibleArgumentParser
from ...utils import VLLM_PATH
LORA_MODULE = { LORA_MODULE = {
"name": "module2", "name": "module2",
"path": "/path/to/module2", "path": "/path/to/module2",
@@ -32,8 +32,8 @@ import pytest
import uvicorn import uvicorn
from fastapi import FastAPI, Response from fastapi import FastAPI, Response
import vllm.entrypoints.openai.dp_supervisor as dp_sup import vllm.entrypoints.launchers.dp_supervisor as dp_sup
from vllm.entrypoints.openai.dp_supervisor import ( from vllm.entrypoints.launchers.dp_supervisor import (
CHILD_EXIT_GRACE_S, CHILD_EXIT_GRACE_S,
DPSupervisor, DPSupervisor,
_build_vllm_dp_server_args, _build_vllm_dp_server_args,
+1 -1
View File
@@ -18,7 +18,7 @@ from fastapi import FastAPI
from vllm_add_dummy_endpoint_plugin import DummyAdminEndpointPlugin from vllm_add_dummy_endpoint_plugin import DummyAdminEndpointPlugin
from vllm.entrypoints.launchers.app import build_app from vllm.entrypoints.launchers.app import build_app
from vllm.entrypoints.openai.cli_args import make_arg_parser from vllm.entrypoints.launchers.cli_args import make_arg_parser
from vllm.plugins import load_endpoint_plugins from vllm.plugins import load_endpoint_plugins
from vllm.plugins.endpoint_plugins.interface import ( from vllm.plugins.endpoint_plugins.interface import (
EndpointPlugin, EndpointPlugin,
+2 -2
View File
@@ -7,11 +7,11 @@ import inspect
import uvloop import uvloop
from vllm.entrypoints.cli.types import CLISubcommand from vllm.entrypoints.cli.types import CLISubcommand
from vllm.entrypoints.launchers.render.entry import run_launch_fastapi from vllm.entrypoints.launchers.cli_args import (
from vllm.entrypoints.openai.cli_args import (
make_arg_parser, make_arg_parser,
validate_parsed_serve_args, validate_parsed_serve_args,
) )
from vllm.entrypoints.launchers.render.entry import run_launch_fastapi
from vllm.entrypoints.serve.utils.api_utils import VLLM_SUBCMD_PARSER_EPILOG from vllm.entrypoints.serve.utils.api_utils import VLLM_SUBCMD_PARSER_EPILOG
from vllm.logger import init_logger from vllm.logger import init_logger
from vllm.utils.argparse_utils import FlexibleArgumentParser from vllm.utils.argparse_utils import FlexibleArgumentParser
+5 -2
View File
@@ -11,8 +11,11 @@ import vllm
import vllm.envs as envs import vllm.envs as envs
from vllm.entrypoints.cli.types import CLISubcommand from vllm.entrypoints.cli.types import CLISubcommand
from vllm.entrypoints.launchers.api_server.entry import run_server, setup_server from vllm.entrypoints.launchers.api_server.entry import run_server, setup_server
from vllm.entrypoints.openai.cli_args import make_arg_parser, validate_parsed_serve_args from vllm.entrypoints.launchers.cli_args import (
from vllm.entrypoints.openai.dp_supervisor import run_dp_supervisor make_arg_parser,
validate_parsed_serve_args,
)
from vllm.entrypoints.launchers.dp_supervisor import run_dp_supervisor
from vllm.entrypoints.serve.utils.api_utils import VLLM_SUBCMD_PARSER_EPILOG from vllm.entrypoints.serve.utils.api_utils import VLLM_SUBCMD_PARSER_EPILOG
from vllm.logger import init_logger from vllm.logger import init_logger
from vllm.usage.usage_lib import UsageContext from vllm.usage.usage_lib import UsageContext
@@ -204,12 +204,13 @@ async def run_server_worker(
def main(): def main():
import uvloop import uvloop
from vllm.entrypoints.openai.cli_args import ( from vllm.entrypoints.serve.utils.api_utils import cli_env_setup
from vllm.utils.argparse_utils import FlexibleArgumentParser
from ..cli_args import (
make_arg_parser, make_arg_parser,
validate_parsed_serve_args, validate_parsed_serve_args,
) )
from vllm.entrypoints.serve.utils.api_utils import cli_env_setup
from vllm.utils.argparse_utils import FlexibleArgumentParser
# NOTE(simon): # NOTE(simon):
# This section should be in sync with vllm/entrypoints/cli/main.py for CLI # This section should be in sync with vllm/entrypoints/cli/main.py for CLI
@@ -1,9 +1,8 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
""" """
This file contains the command line arguments for the vLLM's This file contains the command line arguments for the vLLM's online server.
OpenAI-compatible server. It is kept in a separate file for documentation It is kept in a separate file for documentation purposes.
purposes.
""" """
import argparse import argparse
@@ -20,14 +19,15 @@ from vllm.entrypoints.chat_utils import (
ChatTemplateContentFormatOption, ChatTemplateContentFormatOption,
validate_chat_template, validate_chat_template,
) )
from vllm.entrypoints.launchers.utils.constants import (
H11_MAX_HEADER_COUNT_DEFAULT,
H11_MAX_INCOMPLETE_EVENT_SIZE_DEFAULT,
)
from vllm.entrypoints.openai.models.protocol import LoRAModulePath from vllm.entrypoints.openai.models.protocol import LoRAModulePath
from vllm.tool_parsers import ToolParserManager from vllm.tool_parsers import ToolParserManager
from vllm.utils.argparse_utils import FlexibleArgumentParser from vllm.utils.argparse_utils import FlexibleArgumentParser
from .utils.constants import (
H11_MAX_HEADER_COUNT_DEFAULT,
H11_MAX_INCOMPLETE_EVENT_SIZE_DEFAULT,
)
class LoRAParserAction(argparse.Action): class LoRAParserAction(argparse.Action):
def __call__( def __call__(
@@ -449,7 +449,7 @@ def validate_parsed_serve_args(args: argparse.Namespace):
) )
if args.data_parallel_multi_port_external_lb: if args.data_parallel_multi_port_external_lb:
from vllm.entrypoints.openai.dp_supervisor import ( from vllm.entrypoints.launchers.dp_supervisor import (
validate_multi_port_external_lb_args, validate_multi_port_external_lb_args,
) )
@@ -23,8 +23,6 @@ import uvloop
from fastapi import FastAPI, Response from fastapi import FastAPI, Response
import vllm.envs as envs import vllm.envs as envs
from vllm.entrypoints.launchers.launcher import NoSignalServer
from vllm.entrypoints.launchers.utils.server_utils import get_uvicorn_log_config
from vllm.logger import init_logger from vllm.logger import init_logger
from vllm.utils.system_utils import ( from vllm.utils.system_utils import (
decorate_logs, decorate_logs,
@@ -33,6 +31,9 @@ from vllm.utils.system_utils import (
) )
from vllm.v1.engine.utils import get_engine_process_shutdown_timeout from vllm.v1.engine.utils import get_engine_process_shutdown_timeout
from .launcher import NoSignalServer
from .utils.server_utils import get_uvicorn_log_config
logger = init_logger(__name__) logger = init_logger(__name__)
CHILD_EXIT_GRACE_S = 5.0 CHILD_EXIT_GRACE_S = 5.0
+4 -3
View File
@@ -101,12 +101,13 @@ async def run_launch_fastapi(args: argparse.Namespace) -> None:
if __name__ == "__main__": if __name__ == "__main__":
import uvloop import uvloop
from vllm.entrypoints.openai.cli_args import ( from vllm.entrypoints.serve.utils.api_utils import cli_env_setup
from vllm.utils.argparse_utils import FlexibleArgumentParser
from ..cli_args import (
make_arg_parser, make_arg_parser,
validate_parsed_serve_args, validate_parsed_serve_args,
) )
from vllm.entrypoints.serve.utils.api_utils import cli_env_setup
from vllm.utils.argparse_utils import FlexibleArgumentParser
cli_env_setup() cli_env_setup()
parser = FlexibleArgumentParser( parser = FlexibleArgumentParser(
+3 -2
View File
@@ -31,12 +31,10 @@ from vllm.config import config
from vllm.connections import HTTPResponseSizeExceededError, global_http_connection from vllm.connections import HTTPResponseSizeExceededError, global_http_connection
from vllm.engine.arg_utils import AsyncEngineArgs from vllm.engine.arg_utils import AsyncEngineArgs
from vllm.engine.protocol import EngineClient from vllm.engine.protocol import EngineClient
from vllm.entrypoints.launchers.api_server.entry import init_app_state
from vllm.entrypoints.openai.chat_completion.protocol import ( from vllm.entrypoints.openai.chat_completion.protocol import (
ChatCompletionRequest, ChatCompletionRequest,
ChatCompletionResponse, ChatCompletionResponse,
) )
from vllm.entrypoints.openai.cli_args import BaseFrontendArgs
from vllm.entrypoints.openai.engine.protocol import ( from vllm.entrypoints.openai.engine.protocol import (
ErrorInfo, ErrorInfo,
ErrorResponse, ErrorResponse,
@@ -71,6 +69,9 @@ from vllm.utils.argparse_utils import FlexibleArgumentParser
from vllm.utils.mem_constants import MiB_bytes from vllm.utils.mem_constants import MiB_bytes
from vllm.version import __version__ as VLLM_VERSION from vllm.version import __version__ as VLLM_VERSION
from .api_server.entry import init_app_state
from .cli_args import BaseFrontendArgs
logger = init_logger(__name__) logger = init_logger(__name__)
+1 -1
View File
@@ -206,7 +206,7 @@ def get_max_tokens(
def get_non_default_args(args: Namespace | EngineArgs) -> dict[str, Any]: def get_non_default_args(args: Namespace | EngineArgs) -> dict[str, Any]:
from vllm.entrypoints.openai.cli_args import make_arg_parser from vllm.entrypoints.launchers.cli_args import make_arg_parser
non_default_args = {} non_default_args = {}