[Frontend] Move cli_args.py and dp_supervisor.py out openai folder (#53659)
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
wang.yuqi committed
Aug 25, 2026 at 15:02 UTC
735daf8ef64b7e4b2db9b7186c8160d335cb528f
14 files changed
+42
-33
docs/mkdocs/gen_files/generate_argparse.py
+1
-1
@@ -179,7 +179,7 @@ LaunchSubcommandBase = auto_mock("vllm.entrypoints.cli.launch", "LaunchSubcomman
179
launch_description = auto_mock("vllm.entrypoints.cli.launch", "DESCRIPTION")
180
RenderSubcommand = auto_mock("vllm.entrypoints.cli.launch", "RenderSubcommand")
181
sweep_subcommands = auto_mock("vllm.benchmarks.sweep.cli", "SUBCOMMANDS")
182
-openai_cli_args = auto_mock("vllm.entrypoints.openai", "cli_args")
182
+openai_cli_args = auto_mock("vllm.entrypoints.launchers", "cli_args")
183
run_batch = auto_mock("vllm.entrypoints.launchers", "run_batch")
184
185
if TYPE_CHECKING:
tests/engine/test_arg_utils.py
+2
-2
@@ -869,7 +869,7 @@ class TestDpDeviceIdSharding:
869
against its inherited device-control env var."""
870
import argparse
871
872
- from vllm.entrypoints.openai.dp_supervisor import _build_device_ids
872
+ from vllm.entrypoints.launchers.dp_supervisor import _build_device_ids
873
874
args = argparse.Namespace(
875
tensor_parallel_size=2, pipeline_parallel_size=1, device_ids=None
@@ -881,7 +881,7 @@ class TestDpDeviceIdSharding:
881
"""User-provided --device-ids are sharded across DP children."""
882
import argparse
883
884
- from vllm.entrypoints.openai.dp_supervisor import _build_device_ids
884
+ from vllm.entrypoints.launchers.dp_supervisor import _build_device_ids
885
886
args = argparse.Namespace(
887
tensor_parallel_size=2, pipeline_parallel_size=1, device_ids=[4, 5, 6, 7]
tests/entrypoints/cohere/test_registry_and_args.py
+1
-1
@@ -18,7 +18,7 @@ import typing
18
import pytest
19
20
from vllm.config.model import TokenizerMode
21
-from vllm.entrypoints.openai.cli_args import BaseFrontendArgs, make_arg_parser
21
+from vllm.entrypoints.launchers.cli_args import BaseFrontendArgs, make_arg_parser
22
from vllm.renderers.registry import RENDERER_REGISTRY
23
from vllm.tokenizers.registry import TokenizerRegistry
24
from vllm.utils.argparse_utils import FlexibleArgumentParser
tests/entrypoints/launchers/test_cli_args.py
renamed
+5
-3
@@ -5,12 +5,14 @@ import json
5
6
import pytest
7
8
-from vllm.entrypoints.openai.cli_args import make_arg_parser, validate_parsed_serve_args
8
+from tests.utils import VLLM_PATH
9
+from vllm.entrypoints.launchers.cli_args import (
10
+ make_arg_parser,
11
+ validate_parsed_serve_args,
12
+)
13
from vllm.entrypoints.openai.models.protocol import LoRAModulePath
14
from vllm.utils.argparse_utils import FlexibleArgumentParser
15
12
-from ...utils import VLLM_PATH
13
-
16
LORA_MODULE = {
17
"name": "module2",
18
"path": "/path/to/module2",
tests/entrypoints/launchers/test_dp_supervisor.py
renamed
+2
-2
@@ -32,8 +32,8 @@ import pytest
32
import uvicorn
33
from fastapi import FastAPI, Response
34
35
-import vllm.entrypoints.openai.dp_supervisor as dp_sup
36
-from vllm.entrypoints.openai.dp_supervisor import (
35
+import vllm.entrypoints.launchers.dp_supervisor as dp_sup
36
+from vllm.entrypoints.launchers.dp_supervisor import (
37
CHILD_EXIT_GRACE_S,
38
DPSupervisor,
39
_build_vllm_dp_server_args,
tests/plugins_tests/test_endpoint_plugins.py
+1
-1
@@ -18,7 +18,7 @@ from fastapi import FastAPI
18
from vllm_add_dummy_endpoint_plugin import DummyAdminEndpointPlugin
19
20
from vllm.entrypoints.launchers.app import build_app
21
-from vllm.entrypoints.openai.cli_args import make_arg_parser
21
+from vllm.entrypoints.launchers.cli_args import make_arg_parser
22
from vllm.plugins import load_endpoint_plugins
23
from vllm.plugins.endpoint_plugins.interface import (
24
EndpointPlugin,
vllm/entrypoints/cli/launch.py
+2
-2
@@ -7,11 +7,11 @@ import inspect
7
import uvloop
8
9
from vllm.entrypoints.cli.types import CLISubcommand
10
-from vllm.entrypoints.launchers.render.entry import run_launch_fastapi
11
-from vllm.entrypoints.openai.cli_args import (
10
+from vllm.entrypoints.launchers.cli_args import (
11
make_arg_parser,
12
validate_parsed_serve_args,
13
)
14
+from vllm.entrypoints.launchers.render.entry import run_launch_fastapi
15
from vllm.entrypoints.serve.utils.api_utils import VLLM_SUBCMD_PARSER_EPILOG
16
from vllm.logger import init_logger
17
from vllm.utils.argparse_utils import FlexibleArgumentParser
vllm/entrypoints/cli/serve.py
+5
-2
@@ -11,8 +11,11 @@ import vllm
11
import vllm.envs as envs
12
from vllm.entrypoints.cli.types import CLISubcommand
13
from vllm.entrypoints.launchers.api_server.entry import run_server, setup_server
14
-from vllm.entrypoints.openai.cli_args import make_arg_parser, validate_parsed_serve_args
15
-from vllm.entrypoints.openai.dp_supervisor import run_dp_supervisor
14
+from vllm.entrypoints.launchers.cli_args import (
15
+ make_arg_parser,
16
+ validate_parsed_serve_args,
17
+)
18
+from vllm.entrypoints.launchers.dp_supervisor import run_dp_supervisor
19
from vllm.entrypoints.serve.utils.api_utils import VLLM_SUBCMD_PARSER_EPILOG
20
from vllm.logger import init_logger
21
from vllm.usage.usage_lib import UsageContext
vllm/entrypoints/launchers/api_server/entry.py
+4
-3
@@ -204,12 +204,13 @@ async def run_server_worker(
204
def main():
205
import uvloop
206
207
- from vllm.entrypoints.openai.cli_args import (
207
+ from vllm.entrypoints.serve.utils.api_utils import cli_env_setup
208
+ from vllm.utils.argparse_utils import FlexibleArgumentParser
209
+
210
+ from ..cli_args import (
211
make_arg_parser,
212
validate_parsed_serve_args,
213
)
211
- from vllm.entrypoints.serve.utils.api_utils import cli_env_setup
212
- from vllm.utils.argparse_utils import FlexibleArgumentParser
214
215
# NOTE(simon):
216
# This section should be in sync with vllm/entrypoints/cli/main.py for CLI
vllm/entrypoints/launchers/cli_args.py
renamed
+8
-8
@@ -1,9 +1,8 @@
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
"""
4
-This file contains the command line arguments for the vLLM's
5
-OpenAI-compatible server. It is kept in a separate file for documentation
6
-purposes.
4
+This file contains the command line arguments for the vLLM's online server.
5
+It is kept in a separate file for documentation purposes.
6
"""
7
8
import argparse
@@ -20,14 +19,15 @@ from vllm.entrypoints.chat_utils import (
19
ChatTemplateContentFormatOption,
20
validate_chat_template,
21
)
23
-from vllm.entrypoints.launchers.utils.constants import (
24
- H11_MAX_HEADER_COUNT_DEFAULT,
25
- H11_MAX_INCOMPLETE_EVENT_SIZE_DEFAULT,
26
-)
22
from vllm.entrypoints.openai.models.protocol import LoRAModulePath
23
from vllm.tool_parsers import ToolParserManager
24
from vllm.utils.argparse_utils import FlexibleArgumentParser
25
26
+from .utils.constants import (
27
+ H11_MAX_HEADER_COUNT_DEFAULT,
28
+ H11_MAX_INCOMPLETE_EVENT_SIZE_DEFAULT,
29
+)
30
+
31
32
class LoRAParserAction(argparse.Action):
33
def __call__(
@@ -449,7 +449,7 @@ def validate_parsed_serve_args(args: argparse.Namespace):
449
)
450
451
if args.data_parallel_multi_port_external_lb:
452
- from vllm.entrypoints.openai.dp_supervisor import (
452
+ from vllm.entrypoints.launchers.dp_supervisor import (
453
validate_multi_port_external_lb_args,
454
)
455
vllm/entrypoints/launchers/dp_supervisor.py
renamed
+3
-2
@@ -23,8 +23,6 @@ import uvloop
23
from fastapi import FastAPI, Response
24
25
import vllm.envs as envs
26
-from vllm.entrypoints.launchers.launcher import NoSignalServer
27
-from vllm.entrypoints.launchers.utils.server_utils import get_uvicorn_log_config
26
from vllm.logger import init_logger
27
from vllm.utils.system_utils import (
28
decorate_logs,
@@ -33,6 +31,9 @@ from vllm.utils.system_utils import (
31
)
32
from vllm.v1.engine.utils import get_engine_process_shutdown_timeout
33
34
+from .launcher import NoSignalServer
35
+from .utils.server_utils import get_uvicorn_log_config
36
+
37
logger = init_logger(__name__)
38
39
CHILD_EXIT_GRACE_S = 5.0
vllm/entrypoints/launchers/render/entry.py
+4
-3
@@ -101,12 +101,13 @@ async def run_launch_fastapi(args: argparse.Namespace) -> None:
101
if __name__ == "__main__":
102
import uvloop
103
104
- from vllm.entrypoints.openai.cli_args import (
104
+ from vllm.entrypoints.serve.utils.api_utils import cli_env_setup
105
+ from vllm.utils.argparse_utils import FlexibleArgumentParser
106
+
107
+ from ..cli_args import (
108
make_arg_parser,
109
validate_parsed_serve_args,
110
)
108
- from vllm.entrypoints.serve.utils.api_utils import cli_env_setup
109
- from vllm.utils.argparse_utils import FlexibleArgumentParser
111
112
cli_env_setup()
113
parser = FlexibleArgumentParser(
vllm/entrypoints/launchers/run_batch.py
+3
-2
@@ -31,12 +31,10 @@ from vllm.config import config
31
from vllm.connections import HTTPResponseSizeExceededError, global_http_connection
32
from vllm.engine.arg_utils import AsyncEngineArgs
33
from vllm.engine.protocol import EngineClient
34
-from vllm.entrypoints.launchers.api_server.entry import init_app_state
34
from vllm.entrypoints.openai.chat_completion.protocol import (
35
ChatCompletionRequest,
36
ChatCompletionResponse,
37
)
39
-from vllm.entrypoints.openai.cli_args import BaseFrontendArgs
38
from vllm.entrypoints.openai.engine.protocol import (
39
ErrorInfo,
40
ErrorResponse,
@@ -71,6 +69,9 @@ from vllm.utils.argparse_utils import FlexibleArgumentParser
69
from vllm.utils.mem_constants import MiB_bytes
70
from vllm.version import __version__ as VLLM_VERSION
71
72
+from .api_server.entry import init_app_state
73
+from .cli_args import BaseFrontendArgs
74
+
75
logger = init_logger(__name__)
76
77
vllm/entrypoints/serve/utils/api_utils.py
+1
-1
@@ -206,7 +206,7 @@ def get_max_tokens(
206
207
208
def get_non_default_args(args: Namespace | EngineArgs) -> dict[str, Any]:
209
- from vllm.entrypoints.openai.cli_args import make_arg_parser
209
+ from vllm.entrypoints.launchers.cli_args import make_arg_parser
210
211
non_default_args = {}
212