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

Method run_server

tensorrt_llm/executor/rpc/rpc_server.py:701–723  ·  view source on GitHub ↗

Run the server until shutdown.

()

Source from the content-addressed store, hash-verified

699 self._shutdown_event = asyncio.Event()
700
701 async def run_server():
702 """Run the server until shutdown."""
703 try:
704 await self._run_server()
705 except asyncio.CancelledError:
706 logger_debug("[server] Server task cancelled")
707 except Exception as e:
708 logger.error(f"Server error: {e}")
709 logger.error(traceback.format_exc())
710 finally:
711 # Cancel all worker tasks
712 for task in self._worker_tasks:
713 if not task.done():
714 task.cancel()
715 # Wait for all tasks to complete
716 if self._worker_tasks:
717 await asyncio.gather(*self._worker_tasks,
718 return_exceptions=True)
719
720 # Drain any remaining requests and send cancellation responses
721 await self._drain_pending_requests()
722
723 logger_debug("[server] All server tasks completed")
724
725 self._main_task = self._loop.create_task(run_server())
726

Callers

nothing calls this directly

Calls 5

_run_serverMethod · 0.95
logger_debugFunction · 0.85
cancelMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected