[Frontend] Move run_batch.py out openai folder (#53500)
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
This commit is contained in:
+10
-10
@@ -14,14 +14,14 @@ import pytest
|
||||
import vllm.envs as envs
|
||||
from vllm.assets.audio import AudioAsset
|
||||
from vllm.connections import HTTPConnection
|
||||
from vllm.entrypoints.openai.engine.protocol import ErrorResponse
|
||||
from vllm.entrypoints.openai.run_batch import (
|
||||
from vllm.entrypoints.launchers.run_batch import (
|
||||
BatchRequestOutput,
|
||||
BatchTranscriptionRequest,
|
||||
download_bytes_from_url,
|
||||
make_transcription_wrapper,
|
||||
upload_data,
|
||||
)
|
||||
from vllm.entrypoints.openai.engine.protocol import ErrorResponse
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
from vllm.utils.mem_constants import MiB_bytes
|
||||
|
||||
@@ -920,7 +920,7 @@ async def test_download_bytes_allows_permitted_domain():
|
||||
mock_session = _make_aiohttp_mocks(expected)
|
||||
|
||||
with patch(
|
||||
"vllm.entrypoints.openai.run_batch.aiohttp.ClientSession",
|
||||
"vllm.entrypoints.launchers.run_batch.aiohttp.ClientSession",
|
||||
return_value=mock_session,
|
||||
):
|
||||
result = await download_bytes_from_url(
|
||||
@@ -937,7 +937,7 @@ async def test_download_bytes_no_allowlist_permits_any_domain():
|
||||
mock_session = _make_aiohttp_mocks(expected)
|
||||
|
||||
with patch(
|
||||
"vllm.entrypoints.openai.run_batch.aiohttp.ClientSession",
|
||||
"vllm.entrypoints.launchers.run_batch.aiohttp.ClientSession",
|
||||
return_value=mock_session,
|
||||
):
|
||||
result = await download_bytes_from_url(url, allowed_media_domains=None)
|
||||
@@ -994,7 +994,7 @@ async def test_transcription_wrapper_rejects_oversized_data_url_before_decode(
|
||||
}
|
||||
)
|
||||
|
||||
with patch("vllm.entrypoints.openai.run_batch.base64.b64decode") as decode:
|
||||
with patch("vllm.entrypoints.launchers.run_batch.base64.b64decode") as decode:
|
||||
response = await wrapped_handler(request)
|
||||
|
||||
assert isinstance(response, ErrorResponse)
|
||||
@@ -1011,7 +1011,7 @@ async def test_download_bytes_allows_http_body_at_audio_limit(
|
||||
monkeypatch.setattr(envs, "VLLM_MAX_AUDIO_CLIP_FILESIZE_MB", 1)
|
||||
connection = HTTPConnection()
|
||||
monkeypatch.setattr(
|
||||
"vllm.entrypoints.openai.run_batch.global_http_connection",
|
||||
"vllm.entrypoints.launchers.run_batch.global_http_connection",
|
||||
connection,
|
||||
)
|
||||
|
||||
@@ -1032,7 +1032,7 @@ async def test_transcription_wrapper_rejects_oversized_http_before_handler(
|
||||
monkeypatch.setattr(envs, "VLLM_MAX_AUDIO_CLIP_FILESIZE_MB", 1)
|
||||
connection = HTTPConnection()
|
||||
monkeypatch.setattr(
|
||||
"vllm.entrypoints.openai.run_batch.global_http_connection",
|
||||
"vllm.entrypoints.launchers.run_batch.global_http_connection",
|
||||
connection,
|
||||
)
|
||||
handler = AsyncMock()
|
||||
@@ -1080,7 +1080,7 @@ async def test_upload_data_uploads_once_on_success():
|
||||
"""A successful upload must not be retried (regression guard)."""
|
||||
session = _make_aiohttp_put_session(status=200)
|
||||
with patch(
|
||||
"vllm.entrypoints.openai.run_batch.aiohttp.ClientSession",
|
||||
"vllm.entrypoints.launchers.run_batch.aiohttp.ClientSession",
|
||||
return_value=session,
|
||||
):
|
||||
await upload_data(
|
||||
@@ -1095,11 +1095,11 @@ async def test_upload_data_error_includes_awaited_response_body():
|
||||
session = _make_aiohttp_put_session(status=500, body_text="server-error-detail")
|
||||
with (
|
||||
patch(
|
||||
"vllm.entrypoints.openai.run_batch.aiohttp.ClientSession",
|
||||
"vllm.entrypoints.launchers.run_batch.aiohttp.ClientSession",
|
||||
return_value=session,
|
||||
),
|
||||
patch(
|
||||
"vllm.entrypoints.openai.run_batch.asyncio.sleep",
|
||||
"vllm.entrypoints.launchers.run_batch.asyncio.sleep",
|
||||
AsyncMock(),
|
||||
),
|
||||
pytest.raises(Exception) as exc_info,
|
||||
@@ -450,7 +450,7 @@ def test_metrics_exist_run_batch():
|
||||
[
|
||||
sys.executable,
|
||||
"-m",
|
||||
"vllm.entrypoints.openai.run_batch",
|
||||
"vllm.entrypoints.launchers.run_batch",
|
||||
"-i",
|
||||
input_file.name,
|
||||
"-o",
|
||||
|
||||
Reference in New Issue
Block a user