Skip to content

test(router): contrast shared vs independent RR counters in select_pd_pair - #2050

Closed
OftenDream wants to merge 1 commit into
smg-project:mainfrom
OftenDream:fix/pd-rr-stage-ut-shared-vs-independent
Closed

OftenDream wants to merge 1 commit into
smg-project:mainfrom
OftenDream:fix/pd-rr-stage-ut-shared-vs-independent

Conversation

@OftenDream

Copy link
Copy Markdown
Contributor

Summary

  • Strengthen PD round-robin regressions so tests distinguish a shared counter from independent P/D counters.
  • Stage-level tests drive WorkerSelectionStage::select_pd_pair (via get_prefill_policy / get_decode_policy):
    • shared one RoundRobinPolicy Arc → prefill [20,0,20,0], decode [0,20,0,20]
    • independent Arcs → both pools [10,10,10,10]
  • Clarify the policy-level algorithm contrast test naming/assertions.

Test plan

  • select_pd_pair_shared_round_robin_counter_skips_half_the_workers
  • select_pd_pair_independent_round_robin_counters_cover_all_workers
  • test_shared_vs_independent_counters_across_two_pools

Made with Cursor

…_pair

Add stage-level regressions that drive WorkerSelectionStage::select_pd_pair
with one shared RoundRobinPolicy Arc versus two independent instances, so
the UT distinguishes the shared-counter skew from the fixed coverage.

Signed-off-by: yangxurui <yangxurui@meituan.com>
Co-authored-by: longcat-ia-team <312376714+longcat-ia-team@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added grpc gRPC client and router changes model-gateway Model gateway crate changes labels Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a368f758-01d1-4778-8b3b-092b28b66423

📥 Commits

Reviewing files that changed from the base of the PR and between def90a2 and 7d7222b.

📒 Files selected for processing (2)
  • model_gateway/src/policies/round_robin.rs
  • model_gateway/src/routers/grpc/common/stages/worker_selection.rs

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Expanded worker-selection coverage for shared and independent round-robin policies.
    • Added clearer assertions and documentation for selection behavior.
    • Confirmed expected worker distribution and alternation remain unchanged.

Walkthrough

The PR expands round-robin tests to distinguish shared and independent counters. PD worker-selection tests add shared helpers and verify alternating selections for shared policies and even distribution for independent policies.

Changes

Round-robin worker selection

Layer / File(s) Summary
Round-robin counter assertions
model_gateway/src/policies/round_robin.rs
The test name, comments, and assertion messages describe shared-counter alternation and independent-counter distribution.
PD selection scenarios
model_gateway/src/routers/grpc/common/stages/worker_selection.rs
Helpers aggregate worker selections. Tests cover alternating workers with shared policies and even worker coverage with independent policies.

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

Possibly related PRs

Suggested labels: tests

Suggested reviewers: catherinesue, key4ng

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: testing shared versus independent round-robin counters in select_pd_pair.
Description check ✅ Passed The description directly explains the test scenarios, expected distributions, and policy-level test updates.
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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@OftenDream

Copy link
Copy Markdown
Contributor Author

Closing for now; will reopen/create when ready.

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

Labels

grpc gRPC client and router changes model-gateway Model gateway crate changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant