[Core][AMD] Propagate shutdown timeout to MultiprocExecutor (#43154)

Signed-off-by: Ryan Rock <ryan.rock@amd.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Ryan Rock
2026-06-12 15:13:31 -05:00
committed by GitHub
co-authored by gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent efe7adb5e1
commit aab639c705
5 changed files with 71 additions and 2 deletions
+45
View File
@@ -14,6 +14,7 @@ from vllm.engine.arg_utils import AsyncEngineArgs, EngineArgs
from vllm.sampling_params import SamplingParams
from vllm.v1.engine.async_llm import AsyncLLM
from vllm.v1.engine.llm_engine import LLMEngine
from vllm.v1.executor import multiproc_executor as multiproc_executor_module
from vllm.v1.executor.abstract import Executor
from vllm.v1.executor.multiproc_executor import MultiprocExecutor
from vllm.v1.executor.uniproc_executor import (
@@ -43,6 +44,50 @@ def test_supports_async_scheduling_multiproc_executor():
assert MultiprocExecutor.supports_async_scheduling() is True
class _FakeClock:
def __init__(self) -> None:
self.now = 0.0
def time(self) -> float:
return self.now
def sleep(self, seconds: float) -> None:
self.now += seconds
class _FakeProcess:
def __init__(self, clock: _FakeClock, exits_at: float) -> None:
self.clock = clock
self.exits_at = exits_at
self.terminate_called = False
def is_alive(self) -> bool:
return self.clock.time() < self.exits_at
def terminate(self) -> None:
self.terminate_called = True
@pytest.mark.parametrize(
("timeout", "exits_at", "expected_terminate"),
[
pytest.param(6, 5, False, id="worker-exits-before-timeout"),
pytest.param(6, 7, True, id="worker-exceeds-timeout"),
],
)
def test_multiproc_executor_worker_termination_timeout(
monkeypatch, timeout, exits_at, expected_terminate
):
monkeypatch.setenv("VLLM_WORKER_SHUTDOWN_TIMEOUT_SECONDS", str(timeout))
clock = _FakeClock()
monkeypatch.setattr(multiproc_executor_module.time, "time", clock.time)
monkeypatch.setattr(multiproc_executor_module.time, "sleep", clock.sleep)
executor = MultiprocExecutor.__new__(MultiprocExecutor)
proc = _FakeProcess(clock, exits_at=exits_at)
executor._ensure_worker_termination([proc])
assert proc.terminate_called is expected_terminate
class CustomMultiprocExecutor(MultiprocExecutor):
def collective_rpc(
self,