[Frontend] Move api_server.py out openai folder (#52131)

Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
This commit is contained in:
wang.yuqi
2026-08-19 09:43:46 +00:00
committed by GitHub
parent 340b7e4909
commit eac636a7fa
43 changed files with 887 additions and 775 deletions
@@ -10,7 +10,7 @@ from unittest.mock import patch
import pytest
import zmq
from tests.entrypoints.unit_tests._api_server_spawn_workers import (
from tests.entrypoints.launchers.api_server._api_server_spawn_workers import (
exit_before_report_worker,
)
from vllm.utils.network_utils import make_zmq_socket, split_zmq_path
@@ -147,7 +147,7 @@ async def test_shutdown_on_engine_failure(tmp_path: Path):
# dtype, max-len etc set so that this can run in CI
sys.executable,
"-m",
"vllm.entrypoints.openai.api_server",
"vllm.entrypoints.launchers.api_server.entry",
"--model",
MODEL_NAME,
"--dtype",
@@ -7,7 +7,7 @@ from ssl import SSLContext
import pytest
from vllm.entrypoints.serve.utils.ssl import SSLCertRefresher
from vllm.entrypoints.launchers.utils.ssl import SSLCertRefresher
class MockSSLContext(SSLContext):
@@ -14,7 +14,7 @@ import pytest
from fastapi import HTTPException
from prometheus_client import CollectorRegistry
from vllm.entrypoints.openai.api_server import build_app
from vllm.entrypoints.launchers.api_server.entry import build_app
from vllm.exceptions import (
VLLMNotFoundError,
VLLMServerError,
@@ -6,11 +6,10 @@ from tempfile import TemporaryDirectory
import httpx
import pytest
from tests.utils import RemoteOpenAIServer
from vllm import envs
from vllm.version import __version__ as VLLM_VERSION
from ...utils import RemoteOpenAIServer
MODEL_NAME = "Qwen/Qwen3-0.6B"
+1 -1
View File
@@ -6,7 +6,7 @@ import time
import pytest
from vllm.engine.arg_utils import AsyncEngineArgs
from vllm.entrypoints.openai.api_server import (
from vllm.entrypoints.launchers.api_server.entry import (
build_async_engine_client_from_engine_args,
)
from vllm.inputs import TextPrompt
+1 -1
View File
@@ -7,7 +7,7 @@ Script to test add_lora, remove_lora, pin_lora, list_loras functions.
import pytest
from vllm.engine.arg_utils import AsyncEngineArgs, EngineArgs
from vllm.entrypoints.openai.api_server import (
from vllm.entrypoints.launchers.api_server.entry import (
build_async_engine_client_from_engine_args,
)
from vllm.lora.request import LoRARequest
+10 -10
View File
@@ -17,14 +17,14 @@ import pytest
from fastapi import FastAPI
from vllm_add_dummy_endpoint_plugin import DummyAdminEndpointPlugin
from vllm.entrypoints.openai.api_server import (
_attach_endpoint_plugins,
_init_endpoint_plugins_state,
build_app,
)
from vllm.entrypoints.launchers.app import build_app
from vllm.entrypoints.openai.cli_args import make_arg_parser
from vllm.plugins import load_endpoint_plugins
from vllm.plugins.endpoint_plugins.interface import EndpointPlugin
from vllm.plugins.endpoint_plugins.interface import (
EndpointPlugin,
attach_endpoint_plugins,
init_endpoint_plugins_state,
)
from vllm.utils.argparse_utils import FlexibleArgumentParser
@@ -157,7 +157,7 @@ def test_attach_is_noop_when_nothing_discovered(monkeypatch: pytest.MonkeyPatch)
monkeypatch.delenv("VLLM_PLUGINS", raising=False)
app = FastAPI()
_attach_endpoint_plugins(app, ("generate",))
attach_endpoint_plugins(app, ("generate",))
assert app.state.endpoint_plugins == []
@@ -172,7 +172,7 @@ async def test_init_state_is_noop_without_phase_a(monkeypatch: pytest.MonkeyPatc
monkeypatch.setenv("VLLM_PLUGINS", "dummy_admin_endpoint_plugin")
state = State()
await _init_endpoint_plugins_state(_FakeEngineClient(), state, _build_args())
await init_endpoint_plugins_state(_FakeEngineClient(), state, _build_args())
assert not hasattr(state, "dummy_engine_client")
@@ -196,7 +196,7 @@ async def test_render_server_attaches_endpoint_plugins_with_no_engine_client(
for route in app.routes
)
await _init_endpoint_plugins_state(None, app.state, args)
await init_endpoint_plugins_state(None, app.state, args)
assert app.state.dummy_engine_client is None
@@ -223,7 +223,7 @@ async def test_endpoint_plugin_end_to_end(monkeypatch: pytest.MonkeyPatch):
)
fake_engine_client = _FakeEngineClient(rpc_result=["cfg-a", "cfg-b"])
await _init_endpoint_plugins_state(fake_engine_client, app.state, args)
await init_endpoint_plugins_state(fake_engine_client, app.state, args)
assert app.state.dummy_engine_client is fake_engine_client