Conversation
… ABC tensorrt_llm/_torch/pyexecutor/scheduler/scheduler.py binds the module-level name MicroBatchScheduler twice: * the abstract base at the top of the file -- class MicroBatchScheduler(ABC) with the @AbstractMethod schedule() that documents the contract and is aligned with MicroBatchScheduler::scheduleRequests in cpp/tensorrt_llm/batch_manager/microBatchScheduler.h * a two-line placeholder further down: class MicroBatchScheduler: """Base class to match structure.""" Python executes both statements, so the second one silently wins. After import the exported name (it is in scheduler/__init__.py's __all__) refers to the empty placeholder, not to the ABC: * issubclass(BindMicroBatchScheduler, MicroBatchScheduler) is False -- BindMicroBatchScheduler is still attached to the now-unreachable ABC * MicroBatchScheduler.schedule does not exist, and the class is no longer abstract, so PyMicroBatchScheduler gets no abstract-method enforcement PyMicroBatchScheduler already implements schedule(), so deleting the placeholder restores the intended base class with no behaviour change. Signed-off-by: Tai An <antai12232931@outlook.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughThe change removes an empty ChangesScheduler cleanup
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~2 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to This cleanup restores the intended scheduler abstraction without introducing an identified merge risk. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
You have many small PRs open; please consolidate |
Description
tensorrt_llm/_torch/pyexecutor/scheduler/scheduler.pybinds the module-level nameMicroBatchSchedulertwice:Python executes both
classstatements, so the second one silently wins. Theplaceholder came in with dbb858a (
[TRTLLM-10029][scheduler] Re-implement MicroBatchScheduler and CapacityScheduler…) alongsidePyMicroBatchScheduler, whichis declared right after it and therefore inherits the placeholder rather than the ABC.
This matters because
MicroBatchScheduleris a public export — it is listed intensorrt_llm/_torch/pyexecutor/scheduler/__init__.py's__all__, sofrom tensorrt_llm._torch.pyexecutor.scheduler import MicroBatchSchedulerhands thecaller the empty placeholder.
Effect
Lifting the three
classstatements out of the file in their upstream order (headersABC/abstractmethodbound for real, no torch needed):So today
BindMicroBatchScheduler— the binding used by_util.pyandauto_deploy/shim/ad_executor.py— is not a subclass of the exportedMicroBatchScheduler, and neither scheduler implementation gets the@abstractmethodenforcement the ABC was written to provide.Fix
Delete the two-line placeholder (4 lines including the surrounding blank lines,
+0 / -4, one file).PyMicroBatchScheduleralready implementsschedule(), so itsatisfies the ABC as-is and nothing else changes: no method bodies, no signatures, no
call sites.
Test Coverage
No behaviour change, so no new test. Existing
tests/unittest/_torch/executor/test_py_scheduler.pycovers
PyMicroBatchSchedulerand continues to apply unchanged.PR Checklist
[JIRA ticket/NVBugs ID/GitHub issue/None][type] SummaryAI-assisted (found by a duplicate-module-level-
classsweep; the effect table abovewas produced by lifting the real class statements out of the upstream file, and I
reviewed the change before submitting).
🤖 Generated with Claude Code
Dev Engineer Review
Removed the duplicate
MicroBatchSchedulerplaceholder. The original abstract base class remains exported, soschedule()enforcement andBindMicroBatchSchedulersubclass recognition are restored. No other source behavior or API changes were identified.QA Engineer Review
No test changes.
Per-File QA Perspective
tensorrt_llm/_torch/pyexecutor/scheduler/scheduler.py: Verify thatMicroBatchSchedulerexposes the abstractschedule()contract and thatBindMicroBatchScheduleris recognized as its subclass. Existing scheduler tests should remain applicable.