11
11
from contextlib import asynccontextmanager
12
12
from functools import partial
13
13
from http import HTTPStatus
14
- from typing import AsyncIterator , Optional , Set
14
+ from typing import AsyncIterator , Set
15
15
16
16
import uvloop
17
17
from fastapi import APIRouter , FastAPI , Request
@@ -95,7 +95,7 @@ async def _force_log():
95
95
96
96
@asynccontextmanager
97
97
async def build_async_engine_client (
98
- args : Namespace ) -> AsyncIterator [Optional [ EngineClient ] ]:
98
+ args : Namespace ) -> AsyncIterator [EngineClient ]:
99
99
100
100
# Context manager to handle engine_client lifecycle
101
101
# Ensures everything is shutdown and cleaned up on error/exit
@@ -110,7 +110,7 @@ async def build_async_engine_client(
110
110
async def build_async_engine_client_from_engine_args (
111
111
engine_args : AsyncEngineArgs ,
112
112
disable_frontend_multiprocessing : bool = False ,
113
- ) -> AsyncIterator [Optional [ EngineClient ] ]:
113
+ ) -> AsyncIterator [EngineClient ]:
114
114
"""
115
115
Create EngineClient, either:
116
116
- in-process using the AsyncLLMEngine Directly
@@ -188,10 +188,8 @@ async def build_async_engine_client_from_engine_args(
188
188
break
189
189
except TimeoutError :
190
190
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
195
193
196
194
yield mp_engine_client # type: ignore[misc]
197
195
finally :
@@ -532,10 +530,6 @@ def signal_handler(*_) -> None:
532
530
signal .signal (signal .SIGTERM , signal_handler )
533
531
534
532
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
-
539
533
app = build_app (args )
540
534
541
535
model_config = await engine_client .get_model_config ()
0 commit comments