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

Method __call__

tensorrt_llm/executor/base_worker.py:731–750  ·  view source on GitHub ↗

This method should be called by a ManagedThread.

(self, timeout: Optional[float] = None)

Source from the content-addressed store, hash-verified

729 raise NotImplementedError
730
731 def __call__(self, timeout: Optional[float] = None) -> bool:
732 ''' This method should be called by a ManagedThread. '''
733 timeout = timeout or 0.1
734 responses = self.worker.engine.await_responses(
735 timeout=datetime.timedelta(seconds=timeout))
736 # filter since The _engine_response_callback may return None
737 responses = list(
738 filter(
739 lambda _: _,
740 [self.worker._engine_response_callback(r) for r in responses]))
741
742 # append the error responses to the temp_error_responses
743 while not self.temp_error_responses.empty():
744 responses.append(self.temp_error_responses.get())
745
746 with nvtx_range_debug(f"await_response-{len(responses)}",
747 color="red",
748 category="Worker"):
749 self.responses_handler(responses)
750 return True
751
752 def handle_for_worker(self, responses: List[tllm.Response]) -> None:
753 ''' Return the responses to asyncio.event_loop. '''

Callers

nothing calls this directly

Calls 7

responses_handlerMethod · 0.95
nvtx_range_debugFunction · 0.85
await_responsesMethod · 0.45
emptyMethod · 0.45
appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected