[Bugfix][Core] Keep resumable sessions that stop while preempted (#58778)
Signed-off-by: David Cheung <d7cheung@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Yifan Zong <yzong@redhat.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
Yifan Zong
parent
2067297b2f
commit
f98ae6a9fd
@@ -9,6 +9,7 @@ from unittest.mock import AsyncMock, MagicMock
|
||||
import pytest
|
||||
|
||||
from vllm.engine.protocol import StreamingInput
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
from vllm.outputs import STREAM_FINISHED, RequestOutput
|
||||
from vllm.sampling_params import RequestOutputKind, SamplingParams
|
||||
from vllm.v1.engine.async_llm import AsyncLLM
|
||||
@@ -107,6 +108,25 @@ def make_output(request_id: str, finished: bool) -> RequestOutput:
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("is_mm_encoder_only", "is_diffusion"),
|
||||
[(True, False), (False, True)],
|
||||
ids=["encoder-only", "diffusion"],
|
||||
)
|
||||
def test_resumable_requests_rejected_for_non_decoder_models(
|
||||
is_mm_encoder_only: bool, is_diffusion: bool
|
||||
):
|
||||
llm = MagicMock()
|
||||
llm.vllm_config.is_mm_encoder_only = is_mm_encoder_only
|
||||
llm.model_config.is_diffusion = is_diffusion
|
||||
|
||||
with pytest.raises(
|
||||
VLLMValidationError,
|
||||
match="Resumable requests are not supported",
|
||||
):
|
||||
AsyncLLM._validate_resumable_request(llm)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_generate_with_async_generator():
|
||||
"""Test generate with an async input generator.
|
||||
@@ -180,6 +200,8 @@ async def test_empty_input_stream_finishes_without_engine_request():
|
||||
llm.get_supported_tasks = AsyncMock(return_value=("generate",))
|
||||
llm._run_output_handler = MagicMock()
|
||||
llm._add_request = AsyncMock()
|
||||
llm.vllm_config = MagicMock(is_mm_encoder_only=False)
|
||||
llm.model_config = MagicMock(is_diffusion=False)
|
||||
|
||||
final_req = MagicMock()
|
||||
final_req.request_id = "request-int"
|
||||
@@ -204,6 +226,7 @@ async def test_empty_input_stream_finishes_without_engine_request():
|
||||
def _make_streaming_llm(num_chunks: int, has_request: bool = True):
|
||||
llm = AsyncLLM.__new__(AsyncLLM)
|
||||
llm._validate_streaming_input_sampling_params = MagicMock()
|
||||
llm._validate_resumable_request = MagicMock()
|
||||
llm.get_supported_tasks = AsyncMock(return_value=("generate",))
|
||||
llm._run_output_handler = MagicMock()
|
||||
llm._add_request = AsyncMock()
|
||||
|
||||
Reference in New Issue
Block a user