@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 5ea5c514da
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, 12:15 UTC

[BugFix] Increase timeout for startup failure test (#17642)

Signed-off-by: Nick Hill <nhill@redhat.com>

Nick Hill committed May 5, 2025 at 13:53 UTC 5ea5c514daf103e71fdae45beed44fcd97b314ce
1 file changed +21 -14
tests/v1/engine/test_engine_core_client.py
+21 -14
@@ -1,12 +1,13 @@
1 # SPDX-License-Identifier: Apache-2.0
2
3 import asyncio
4 +import os
5 +import signal
6 import time
7 import uuid
8 from threading import Thread
9 from typing import Optional
10
9 -import psutil
11 import pytest
12 from transformers import AutoTokenizer
13
@@ -17,8 +18,8 @@ from vllm.platforms import current_platform
18 from vllm.usage.usage_lib import UsageContext
19 from vllm.v1.engine import EngineCoreRequest
20 from vllm.v1.engine.core import EngineCore
20 -from vllm.v1.engine.core_client import (AsyncMPClient, EngineCoreClient,
21 - SyncMPClient)
21 +from vllm.v1.engine.core_client import (AsyncMPClient, CoreEngine,
22 + EngineCoreClient, SyncMPClient)
23 from vllm.v1.executor.abstract import Executor
24
25 from ...distributed.conftest import MockSubscriber
@@ -337,34 +338,40 @@ def test_kv_cache_events(
338 "Token ids should be the same as the custom tokens")
339 finally:
340 client.shutdown()
340 - return
341
342
343 -@pytest.mark.timeout(10)
343 +@pytest.mark.timeout(20)
344 def test_startup_failure(monkeypatch: pytest.MonkeyPatch):
345
346 with monkeypatch.context() as m, pytest.raises(Exception) as e_info:
347 m.setenv("VLLM_USE_V1", "1")
348
349 + # Monkey-patch to extract core process pid while it's starting.
350 + core_proc_pid = [None]
351 + ce_ctor = CoreEngine.__init__
352 +
353 + def patched_ce_ctor(self, *args, **kwargs):
354 + ce_ctor(self, *args, **kwargs)
355 + core_proc_pid[0] = self.proc_handle.proc.pid
356 +
357 + m.setattr(CoreEngine, "__init__", patched_ce_ctor)
358 +
359 + t = time.time()
360 engine_args = EngineArgs(model=MODEL_NAME)
361 vllm_config = engine_args.create_engine_config(
362 usage_context=UsageContext.UNKNOWN_CONTEXT)
363 executor_class = Executor.get_class(vllm_config)
364 + print(f"VllmConfig creation took {time.time() - t:.2f} seconds.")
365
366 # Start another thread to wait for engine core process to start
367 # and kill it - simulate fatal uncaught process exit.
356 - this_proc = psutil.Process()
357 - children_before = set(this_proc.children())
368
369 def kill_first_child():
360 - while True:
370 + while (child_pid := core_proc_pid[0]) is None:
371 time.sleep(0.5)
362 - children = set(this_proc.children()) - children_before
363 - if children:
364 - child = children.pop()
365 - print("Killing child core process", child.pid)
366 - child.kill()
367 - break
372 + print(f"Killing child core process {child_pid}")
373 + assert isinstance(child_pid, int)
374 + os.kill(child_pid, signal.SIGKILL)
375
376 Thread(target=kill_first_child, daemon=True).start()
377