[https://nvbugs/6337231][fix] Replace all 9 self._is_stats_dummy_request(req) calls with…#15489
[https://nvbugs/6337231][fix] Replace all 9 self._is_stats_dummy_request(req) calls with…#15489tensorrt-cicd wants to merge 1 commit into
self._is_stats_dummy_request(req) calls with…#15489Conversation
…agicMock dispatch The predicate _is_stats_dummy_request was promoted from a closure to a @staticmethod in PR NVIDIA#14922 but call sites still invoke it via self._is_stats_dummy_request(req). This works in production because Python's descriptor protocol resolves the staticmethod on a real PyExecutor instance. The unit tests in tests/unittest/pyexecutor/test_iter_stats_populate.py call PyExecutor._update_iter_stats unbound against a MagicMock fake self. With MagicMock, self._is_stats_dummy_request(req) auto-generates a child Mock and returns another truthy Mock, so every request is filtered as a dummy and the KV-token-weighted counters (num_ctx_kv_tokens, num_gen_kv_tokens, num_paused_kv_tokens) end up 0. Replace all 9 call sites with PyExecutor._is_stats_dummy_request(req). This is the conventional way to access a staticmethod, decouples it from self, and lets the regression-guard tests exercise the real predicate without patching every internal helper name on the mock. Signed-off-by: tensorrt-cicd <90828364+tensorrt-cicd@users.noreply.github.com>
|
Caution Review failedAn error occurred during the review process. Please try again later. 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)
📝 WalkthroughWalkthroughIn ChangesDummy Request Filtering — Static Helper Substitution
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
_is_stats_dummy_requestis a@staticmethodbut call sites usedself._is_stats_dummy_request(req); with the unit test's MagicMock fakeself, that returns a truthy child Mock, so every request was filtered as a dummy and KV-token counters became 0.self._is_stats_dummy_request(req)calls withPyExecutor._is_stats_dummy_request(req)— the conventional class-level access for staticmethods, identical behavior in production, and lets the unbound_update_iter_stats(fake_self, ...)tests exercise the real predicate.Test plan
Links
Summary by CodeRabbit