Skip to content

[https://nvbugs/6461799][fix] Import MpiPoolSession from its source module…#16499

Closed
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6461799
Closed

[https://nvbugs/6461799][fix] Import MpiPoolSession from its source module…#16499
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6461799

Conversation

@trtllm-agent

@trtllm-agent trtllm-agent commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: tests/test_common/session_reuse.py monkey-patches MpiPoolSession in the tensorrt_llm.executor.proxy module namespace with a factory function, so isinstance(self.mpi_session, MpiPoolSession) at proxy.py:576 raises TypeError: isinstance() arg 2 must be a type because the second argument is a function, not a class.
  • Fix: Import MpiPoolSession from its source module (tensorrt_llm.llmapi.mpi_session) at the use site so the class reference is resolved fresh from the source module (immune to attribute-level monkeypatching in tensorrt_llm.executor.proxy); leaves the constructor-call site at proxy.py:130 unchanged so session-reuse still intercepts pool creation.
  • Automated fix generated by repair-bot

Test plan

  • Verify fix on the same GPU type as the original failure
  • Check for regressions in related tests

Links

Summary by CodeRabbit

  • Bug Fixes

    • Improved executor worker startup compatibility in runtime-configured environments.
    • Enhanced reliability when launching workloads through customized execution setups.
  • Chores

    • Strengthened internal validation and testing support without changing public APIs or standard execution behavior.

…sinstance check

The test-side session-reuse plugin (tests/test_common/session_reuse.py)
monkey-patches the module-level MpiPoolSession attribute in
tensorrt_llm.executor.proxy with a factory function to intercept pool
construction. This is fine for the constructor call site, but breaks the
isinstance(self.mpi_session, MpiPoolSession) guard added by
e05790a (nvbugs/6435642) — isinstance() rejects a function as its
second argument with TypeError.

Import MpiPoolSession from tensorrt_llm.llmapi.mpi_session at the use
site so the class reference is resolved from the source module and is
immune to attribute-level patching on the proxy module.

Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 720e5ad0-ed78-4ebf-a264-d2ce7dd91b9a

📥 Commits

Reviewing files that changed from the base of the PR and between e158837 and 158d7e1.

📒 Files selected for processing (1)
  • tensorrt_llm/executor/proxy.py

📝 Walkthrough

Walkthrough

_start_executor_workers() now locally re-imports MpiPoolSession immediately before its isinstance check, allowing test monkey-patching of the source module’s class reference to be respected.

Changes

MpiPoolSession type-check handling

Layer / File(s) Summary
Runtime session type resolution
tensorrt_llm/executor/proxy.py
_start_executor_workers() re-imports MpiPoolSession locally before checking self.mpi_session.

Estimated code review effort: 2 (Simple) | ~5 minutes

Possibly related PRs

Suggested reviewers: asfiyab-nvidia

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the bug fix and uses the required ticket/type format, with the main change clearly stated.
Description check ✅ Passed The description includes a clear summary, test plan, and linked bug, covering the template’s required information well enough.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@tongyuantongyu

tongyuantongyu commented Jul 17, 2026

Copy link
Copy Markdown
Member

Close in favor of #16444.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants