@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / e2148dc5ea
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 04:45 UTC

[Bugfix] Add check_health to v1 async client. (#19821)

Signed-off-by: Kourosh Hakhamaneshi <kourosh@anyscale.com>

kourosh hakhamaneshi committed Jun 18, 2025 at 21:47 UTC e2148dc5eaec959a18a73f9f288bd5589efec2c1
2 files changed +31
tests/v1/engine/test_async_llm.py
+29
@@ -369,3 +369,32 @@ async def test_dp_rank_argument(monkeypatch: pytest.MonkeyPatch):
369 sampling_params=sampling_params,
370 data_parallel_rank=1):
371 pass
372 +
373 +
374 +@pytest.mark.asyncio
375 +async def test_check_health(monkeypatch: pytest.MonkeyPatch):
376 + """Test that check_health returns normally for healthy engine
377 + and raises EngineDeadError when the engine is dead.
378 + """
379 + from unittest.mock import patch
380 +
381 + from vllm.v1.engine.exceptions import EngineDeadError
382 +
383 + with monkeypatch.context() as m, ExitStack() as after:
384 + m.setenv("VLLM_USE_V1", "1")
385 +
386 + engine = AsyncLLM.from_engine_args(TEXT_ENGINE_ARGS)
387 + after.callback(engine.shutdown)
388 +
389 + # Test 1: Healthy engine should not raise any exception
390 + await engine.check_health()
391 +
392 + # Test 2: Mock the errored property to simulate a dead engine
393 + with patch.object(type(engine),
394 + 'errored',
395 + new_callable=lambda: property(lambda self: True)
396 + ), pytest.raises(EngineDeadError):
397 + await engine.check_health()
398 +
399 + # Test 3: Verify healthy engine still works after mock
400 + await engine.check_health()
vllm/v1/engine/async_llm.py
+2
@@ -552,6 +552,8 @@ class AsyncLLM(EngineClient):
552
553 async def check_health(self) -> None:
554 logger.debug("Called check_health.")
555 + if self.errored:
556 + raise self.dead_error
557
558 async def start_profile(self) -> None:
559 await self.engine_core.profile_async(True)