Skip to content

Commit a62cdab

Browse files
njhillLeiWang1999
authored andcommitted
[BugFix] Nonzero exit code if MQLLMEngine startup fails (vllm-project#8572)
Signed-off-by: LeiWang1999 <leiwang1999@outlook.com>
1 parent 0043607 commit a62cdab

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

vllm/entrypoints/openai/api_server.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from contextlib import asynccontextmanager
1212
from functools import partial
1313
from http import HTTPStatus
14-
from typing import AsyncIterator, Optional, Set
14+
from typing import AsyncIterator, Set
1515

1616
import uvloop
1717
from fastapi import APIRouter, FastAPI, Request
@@ -95,7 +95,7 @@ async def _force_log():
9595

9696
@asynccontextmanager
9797
async def build_async_engine_client(
98-
args: Namespace) -> AsyncIterator[Optional[EngineClient]]:
98+
args: Namespace) -> AsyncIterator[EngineClient]:
9999

100100
# Context manager to handle engine_client lifecycle
101101
# Ensures everything is shutdown and cleaned up on error/exit
@@ -110,7 +110,7 @@ async def build_async_engine_client(
110110
async def build_async_engine_client_from_engine_args(
111111
engine_args: AsyncEngineArgs,
112112
disable_frontend_multiprocessing: bool = False,
113-
) -> AsyncIterator[Optional[EngineClient]]:
113+
) -> AsyncIterator[EngineClient]:
114114
"""
115115
Create EngineClient, either:
116116
- in-process using the AsyncLLMEngine Directly
@@ -188,10 +188,8 @@ async def build_async_engine_client_from_engine_args(
188188
break
189189
except TimeoutError:
190190
if not engine_process.is_alive():
191-
logger.error("Engine process died before responding "
192-
"to readiness probe")
193-
yield None
194-
return
191+
raise RuntimeError(
192+
"Engine process failed to start") from None
195193

196194
yield mp_engine_client # type: ignore[misc]
197195
finally:
@@ -532,10 +530,6 @@ def signal_handler(*_) -> None:
532530
signal.signal(signal.SIGTERM, signal_handler)
533531

534532
async with build_async_engine_client(args) as engine_client:
535-
# If None, creation of the client failed and we exit.
536-
if engine_client is None:
537-
return
538-
539533
app = build_app(args)
540534

541535
model_config = await engine_client.get_model_config()

0 commit comments

Comments
 (0)