1111from contextlib import asynccontextmanager
1212from functools import partial
1313from http import HTTPStatus
14- from typing import AsyncIterator , Optional , Set
14+ from typing import AsyncIterator , Set
1515
1616import uvloop
1717from fastapi import APIRouter , FastAPI , Request
@@ -95,7 +95,7 @@ async def _force_log():
9595
9696@asynccontextmanager
9797async 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(
110110async 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