diff --git a/tensorrt_llm/executor/proxy.py b/tensorrt_llm/executor/proxy.py index 11451bad5b67..b1a70d444e7d 100644 --- a/tensorrt_llm/executor/proxy.py +++ b/tensorrt_llm/executor/proxy.py @@ -573,7 +573,14 @@ def mpi_done_callback(future: concurrent.futures.Future): raise RuntimeError( "Executor worker returned error") from ready_signal - if isinstance(self.mpi_session, MpiPoolSession) and len(status) == 3: + # Re-import MpiPoolSession from its origin module rather than using the + # module-level name above: test infra (tests/test_common/session_reuse.py) + # monkeypatches this module's ``MpiPoolSession`` attribute to a pool-reuse + # factory function for bare LLM(...) tests, and isinstance() against a + # non-type raises TypeError. + from ..llmapi.mpi_session import MpiPoolSession as _MpiPoolSessionCls + if isinstance(self.mpi_session, + _MpiPoolSessionCls) and len(status) == 3: worker_process_identities: List[WorkerProcessIdentity] = status[2] self._worker_process_monitor.register(worker_process_identities)