|
21 | 21 | IPC_OUTPUT_EXT, RPC_REQUEST_T,
|
22 | 22 | VLLM_RPC_SUCCESS_STR, RPCAbortRequest,
|
23 | 23 | RPCError, RPCProcessRequest,
|
24 |
| - RPCStartupRequest, RPCStartupResponse) |
| 24 | + RPCStartupRequest, RPCStartupResponse, |
| 25 | + RPCUProfileRequest) |
25 | 26 | # yapf: enable
|
26 | 27 | from vllm.envs import VLLM_RPC_TIMEOUT
|
27 | 28 | from vllm.inputs import PromptType
|
|
38 | 39 |
|
39 | 40 | class MQClientClosedError(Exception):
|
40 | 41 | """Exception class raised when the client is used post-close.
|
41 |
| - |
| 42 | +
|
42 | 43 | The client can be closed, which closes the ZMQ context. This normally
|
43 |
| - happens on server shutdown. In some cases, methods like abort and |
44 |
| - do_log_stats will still be called and then try to open a socket, which |
| 44 | + happens on server shutdown. In some cases, methods like abort and |
| 45 | + do_log_stats will still be called and then try to open a socket, which |
45 | 46 | causes a ZMQError and creates a huge stack trace.
|
46 | 47 | So, we throw this error such that we can suppress it.
|
47 | 48 | """
|
@@ -345,7 +346,7 @@ async def do_log_stats(self):
|
345 | 346 | async def check_health(self):
|
346 | 347 | """
|
347 | 348 | The check health loop probes the health status of the
|
348 |
| - Engine's health every N seconds and sets _errored_with |
| 349 | + Engine's health every N seconds and sets _errored_with |
349 | 350 | if the engine is unhealthy.
|
350 | 351 | """
|
351 | 352 | if self._errored_with is not None:
|
@@ -561,3 +562,15 @@ async def _process_request(
|
561 | 562 | await self.abort(request_id)
|
562 | 563 | finally:
|
563 | 564 | self.output_queues.pop(request_id)
|
| 565 | + |
| 566 | + async def start_profile(self) -> None: |
| 567 | + """Start profiling the engine""" |
| 568 | + |
| 569 | + await self._send_one_way_rpc_request( |
| 570 | + request=RPCUProfileRequest.START_PROFILE, socket=self.input_socket) |
| 571 | + |
| 572 | + async def stop_profile(self) -> None: |
| 573 | + """Stop profiling the engine""" |
| 574 | + |
| 575 | + await self._send_one_way_rpc_request( |
| 576 | + request=RPCUProfileRequest.STOP_PROFILE, socket=self.input_socket) |
0 commit comments