MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / _send_error_response

Method _send_error_response

tensorrt_llm/executor/rpc/rpc_server.py:290–316  ·  view source on GitHub ↗

Send an error response for a request.

(self, req: RPCRequest,
                                   error: Exception)

Source from the content-addressed store, hash-verified

288 # - submit() - 3 -> dedicated queue -> dedicated routine/pool
289 # TODO potential optimization: for submit(), batch the ad-hoc requests in an interval like 5ms, reduce the IPC count
290 async def _send_error_response(self, req: RPCRequest,
291 error: Exception) -> None:
292 """Send an error response for a request."""
293 if not req.need_response:
294 return
295
296 if req.is_streaming:
297 await self._client_socket.put_async(
298 RPCResponse(
299 req.request_id,
300 result=None,
301 error=error,
302 is_streaming=
303 True, # Important: mark as streaming so it gets routed correctly
304 stream_status='error'),
305 routing_id=req.routing_id)
306 logger_debug(
307 f"[server] Sent error response for request {req.request_id}",
308 color="green")
309 else:
310 await self._client_socket.put_async(RPCResponse(req.request_id,
311 result=None,
312 error=error),
313 routing_id=req.routing_id)
314 logger_debug(
315 f"[server] Sent error response for request {req.request_id}",
316 color="green")
317
318 async def _handle_shutdown_request(self, req: RPCRequest) -> bool:
319 """Handle a request during shutdown. Returns True if handled."""

Callers 3

_process_requestsMethod · 0.95

Calls 3

RPCResponseClass · 0.85
logger_debugFunction · 0.85
put_asyncMethod · 0.80

Tested by

no test coverage detected