[Frontend] Kill the server on engine death (#6594)
Signed-off-by: Joe Runde <joe@joerun.de> Signed-off-by: Joe Runde <Joseph.Runde@ibm.com>
This commit is contained in:
@@ -33,6 +33,7 @@ class AsyncEngineRPCClient:
|
||||
|
||||
# Wait until server is ready.
|
||||
await self.wait_for_server()
|
||||
self._errored = False
|
||||
|
||||
# Get the configs.
|
||||
self.model_config = await self._get_model_config_rpc()
|
||||
@@ -169,7 +170,7 @@ class AsyncEngineRPCClient:
|
||||
expected_type=SchedulerConfig,
|
||||
error_message="Could not get SchedulerConfig from RPC Server")
|
||||
|
||||
async def _get_lora_config_rpc(self):
|
||||
async def _get_lora_config_rpc(self) -> LoRAConfig:
|
||||
"""Get LoRAConfig from the RPCServer"""
|
||||
|
||||
return await self._send_get_data_rpc_request(
|
||||
@@ -177,7 +178,7 @@ class AsyncEngineRPCClient:
|
||||
expected_type=LoRAConfig,
|
||||
error_message="Could not get LoRAConfig from RPC Server")
|
||||
|
||||
async def _is_tracing_enabled_rpc(self) -> ParallelConfig:
|
||||
async def _is_tracing_enabled_rpc(self) -> bool:
|
||||
"""Get is_tracing_enabled flag from the RPCServer"""
|
||||
|
||||
return await self._send_get_data_rpc_request(
|
||||
@@ -200,6 +201,18 @@ class AsyncEngineRPCClient:
|
||||
request=RPCUtilityRequest.DO_LOG_STATS,
|
||||
error_message="RPCRequest DO_LOG_STATS failed.")
|
||||
|
||||
@property
|
||||
def is_running(self) -> bool:
|
||||
return not self._errored
|
||||
|
||||
@property
|
||||
def is_stopped(self) -> bool:
|
||||
return self._errored
|
||||
|
||||
@property
|
||||
def errored(self) -> bool:
|
||||
return self._errored
|
||||
|
||||
async def generate(
|
||||
self,
|
||||
inputs: PromptInputs,
|
||||
@@ -233,6 +246,15 @@ class AsyncEngineRPCClient:
|
||||
request_output = cloudpickle.loads(message)
|
||||
|
||||
if isinstance(request_output, Exception):
|
||||
# On exception, check if the server is still healthy.
|
||||
# Use this to set the sync `is_running` and `errored`
|
||||
# properties.
|
||||
try:
|
||||
await self.check_health()
|
||||
except Exception:
|
||||
self._errored = True
|
||||
# NB: do before raising here so that the flag is set
|
||||
# by the time the caller receives this exception
|
||||
raise request_output
|
||||
|
||||
finished = request_output.finished
|
||||
|
||||
@@ -96,14 +96,17 @@ class AsyncEngineRPCServer:
|
||||
|
||||
async def abort(self, identity, request: RPCAbortRequest):
|
||||
"""Abort request and notify the client of success."""
|
||||
# Abort the request in the llm engine.
|
||||
await self.engine.abort(request.request_id)
|
||||
|
||||
# Send confirmation to the client.
|
||||
await self.socket.send_multipart([
|
||||
identity,
|
||||
cloudpickle.dumps(VLLM_RPC_SUCCESS_STR),
|
||||
])
|
||||
try:
|
||||
# Abort the request in the llm engine.
|
||||
await self.engine.abort(request.request_id)
|
||||
except Exception:
|
||||
logger.warning("Failed to abort request %s", request.request_id)
|
||||
finally:
|
||||
# Send confirmation to the client.
|
||||
await self.socket.send_multipart([
|
||||
identity,
|
||||
cloudpickle.dumps(VLLM_RPC_SUCCESS_STR),
|
||||
])
|
||||
|
||||
async def generate(self, identity, generate_request: RPCGenerateRequest):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user