Repository navigation
chore: suffix duration config fields with units - #9246
Conversation
WalkthroughThis PR standardizes timing and interval configuration field naming across the Global Router and Planner components by adding explicit unit suffixes ( ChangesTiming Configuration Standardization
🎯 3 (Moderate) | ⏱️ ~25 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. Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
components/src/dynamo/planner/tests/unit/test_planner_config.py (1)
48-65: ⚡ Quick winConsider adding a backward-compatibility alias test for the renamed
PlannerConfigfields.
test_all_fields_workvalidates the new canonical names, but the PR's stated backward-compat guarantee (old keysttft,itl,throughput_adjustment_intervalaccepted viaAliasChoices) has no unit-test coverage in this file. A regression here would silently break users who haven't migrated yet.✅ Suggested test
def test_legacy_field_aliases_accepted(): """Old key names are still accepted via Pydantic AliasChoices.""" config = PlannerConfig( namespace="test-ns", ttft=200, # legacy alias for ttft_ms itl=50, # legacy alias for itl_ms throughput_adjustment_interval=60, # legacy alias for throughput_adjustment_interval_seconds ) assert config.ttft_ms == 200 assert config.itl_ms == 50 assert config.throughput_adjustment_interval_seconds == 60🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/src/dynamo/planner/tests/unit/test_planner_config.py` around lines 48 - 65, Add a unit test to ensure backward-compatible alias names are accepted by PlannerConfig: create a new test function (e.g., test_legacy_field_aliases_accepted) that constructs PlannerConfig using the legacy keys ttft, itl, and throughput_adjustment_interval and asserts they map to PlannerConfig.ttft_ms, PlannerConfig.itl_ms, and PlannerConfig.throughput_adjustment_interval_seconds respectively; this verifies the AliasChoices-based aliases still work alongside the existing test_all_fields_work.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@components/src/dynamo/global_router/handler.py`:
- Line 163: The assignment to ttft_target_ms uses "or" which treats 0 as falsy
and drops explicit zeros; change it to preserve explicit zero by using an
explicit None check (e.g., set ttft_target_ms = extra_args.get("ttft_target") if
extra_args.get("ttft_target") is not None else self.default_ttft_target_ms).
Apply the same pattern where similar logic occurs (the other occurrence
referenced around line 213) and mirror the approach used in handle_generate to
ensure explicit 0 SLA overrides are preserved.
In `@components/src/dynamo/planner/config/planner_config.py`:
- Around line 101-104: PlannerConfig currently enforces positivity only for
ttft_ms inside _validate_config(), so itl_ms can be zero or negative; update
_validate_config() (and any duplicate validation block later) to also validate
that self.itl_ms is strictly > 0 and raise the same ValidationError/ValueError
used for ttft_ms when it isn't, ensuring the new itl_ms Field (aliasing "itl")
gets the same strict-positive check as ttft_ms.
---
Nitpick comments:
In `@components/src/dynamo/planner/tests/unit/test_planner_config.py`:
- Around line 48-65: Add a unit test to ensure backward-compatible alias names
are accepted by PlannerConfig: create a new test function (e.g.,
test_legacy_field_aliases_accepted) that constructs PlannerConfig using the
legacy keys ttft, itl, and throughput_adjustment_interval and asserts they map
to PlannerConfig.ttft_ms, PlannerConfig.itl_ms, and
PlannerConfig.throughput_adjustment_interval_seconds respectively; this verifies
the AliasChoices-based aliases still work alongside the existing
test_all_fields_work.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0121ef73-8811-47d0-b8ee-c8b4f1ae7099
📒 Files selected for processing (36)
components/src/dynamo/global_router/README.mdcomponents/src/dynamo/global_router/__main__.pycomponents/src/dynamo/global_router/backend_args.pycomponents/src/dynamo/global_router/handler.pycomponents/src/dynamo/global_router/pool_selection.pycomponents/src/dynamo/global_router/tests/test_agg_routing.pycomponents/src/dynamo/global_router/tests/test_priority_routing.pycomponents/src/dynamo/planner/config/defaults.pycomponents/src/dynamo/planner/config/planner_config.pycomponents/src/dynamo/planner/core/base.pycomponents/src/dynamo/planner/core/load/predictors.pycomponents/src/dynamo/planner/core/load_scaling.pycomponents/src/dynamo/planner/core/state_machine.pycomponents/src/dynamo/planner/core/throughput_scaling.pycomponents/src/dynamo/planner/monitoring/diagnostics_recorder.pycomponents/src/dynamo/planner/offline/trace_data.pycomponents/src/dynamo/planner/tests/manual/perf_test_configs/disagg_8b_planner.yamlcomponents/src/dynamo/planner/tests/manual/scaling/disagg_planner_load.yamlcomponents/src/dynamo/planner/tests/manual/scaling/disagg_planner_throughput.yamlcomponents/src/dynamo/planner/tests/unit/test_diagnostics_recorder.pycomponents/src/dynamo/planner/tests/unit/test_easy_scaling.pycomponents/src/dynamo/planner/tests/unit/test_load_based_scaling.pycomponents/src/dynamo/planner/tests/unit/test_load_predictors.pycomponents/src/dynamo/planner/tests/unit/test_metric_publication.pycomponents/src/dynamo/planner/tests/unit/test_planner_config.pycomponents/src/dynamo/planner/tests/unit/test_state_machine.pydocs/benchmarks/planner-replay-benchmarking.mddocs/components/planner/README.mddocs/components/planner/planner-guide.mddocs/components/profiler/profiler-guide.mdexamples/backends/sglang/deploy/disagg_planner.yamlexamples/backends/trtllm/deploy/disagg_planner.yamlexamples/backends/vllm/deploy/disagg_planner.yamlexamples/global_planner/global-planner-gpu-budget.yamlexamples/global_planner/global-planner-mocker-test.yamlexamples/global_planner/global-planner-vllm-test.yaml
…nits
Rename duration-bearing config fields to encode their units in the name,
so users don't have to read field comments to know whether a value is
ms, seconds, or hours:
- PlannerConfig: ttft → ttft_ms, itl → itl_ms,
throughput_adjustment_interval → throughput_adjustment_interval_seconds,
load_adjustment_interval → load_adjustment_interval_seconds
- Global router pool selection strategies: ttft_min/max → ttft_min_ms/max_ms,
itl_min/max → itl_min_ms/max_ms (plus matching select_pool params)
- Global router CLI: --default-{ttft,itl}-target → --default-{ttft,itl}-target-ms
Old names are still accepted for backwards compatibility:
- PlannerConfig uses pydantic AliasChoices so old keys validate as before.
- Global router JSON loaders fall back to old keys with a one-line
deprecation warning.
- Global router CLI flags keep the old names as obsolete aliases.
Metrics class fields, DGDR sla.ttft/itl, and per-request extra_args keys
are intentionally left alone — they are not config and renaming them
would change separate API surfaces.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…nv vars The previous commit renamed the env vars to add a _MS suffix without falling back to the un-suffixed names, so users with the legacy env vars silently lost their settings. Use env_or_default to read the legacy var when the new one is unset. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
fb13232 to
b484c7c
Compare
… with units Update test_state_machine.py call sites that pass ttft= / itl= kwargs to _make_core / _make_agg_core (PlannerConfig fields were renamed to ttft_ms / itl_ms).
…ebase Main's #9246 (chore: suffix duration config fields with units) renamed PlannerConfig.ttft -> ttft_ms and PlannerConfig.itl -> itl_ms. Construction keeps working via pydantic's validation_alias=AliasChoices("ttft_ms", "ttft"), so PlannerConfig(ttft=..., itl=...) keyword construction is still accepted, but Python attribute access must use the new names. PR 9369 was based on the pre-rename code and read the SLAs via .ttft / .itl on PlannerConfig instances: - aic_power_optimizer.py: 2 reads (single-engine feasibility check) + 2 reads (should_reoptimize SLA-violation check) - test_aic_real_data.py: 1 read (synthesizing 2x-SLA traffic) All 4 + 1 sites updated. Surfaced as AttributeError when running the 26 alpha-class testbed scenarios (test_scenarios.py::test_alpha[*]). Fixes: 26 testbed alpha-scenario failures, 1 test_self_consistency alpha test Signed-off-by: Kai Ma <[email protected]>
Rebase onto main pulled in PR #9246's PlannerConfig field renames ( tft-> tft_ms, itl->itl_ms, hroughput_adjustment_interval-> hroughput_adjustment_interval_seconds, load_adjustment_interval->load_adjustment_interval_seconds). Two of the four ms-suffix accesses were updated in the prior fixup, but power_aware_replay_adapter.py still accessed the old hroughput_adjustment_interval attribute. Pydantic's AliasChoices only covers constructor input, not attribute access — so all four gamma-class testbed tests failed with:: AttributeError: 'PlannerConfig' object has no attribute 'throughput_adjustment_interval'. Did you mean: 'throughput_adjustment_interval_seconds'? This patch renames the attribute access at line 111 to the new canonical field name. Constructor sites still work via AliasChoices. Signed-off-by: Kai Ma <[email protected]>
Update pr9369-split-plan.md to reflect the kaim/power-planner rebase onto origin/main (merge-base 30def76): * Section 1 inventory: 22,423 -> 22,936 insertions, 15 -> 14 deletions, 4 -> 9 commits. * Section 1.1 commits table: rewritten with the 9 post-rebase SHAs (4 original + 5 rebase fixups). Each old SHA paired with new in 'Was X pre-rebase' annotations. Strengthens the central claim that cherry-picking commits cannot produce the 6 clean PRs; the rebase fixups themselves cross-cut PRs 2-4 and reinforce the file-verbatim mechanic in section 4.2. * New section 1.6 ? Rebase rename collisions. Documents PR #9246's PlannerConfig field renames (ttft/itl/throughput_adjustment_interval/ load_adjustment_interval -> _ms/_seconds suffixes). Notes that pydantic AliasChoices covers construction but not attribute access; hand-authored intermediates in PR 1b/PR 3 must use the canonical names. Also notes the newly enforced pytest-marker-report hook and lists the 7 PR-introduced test files now shipping with module-level pytestmark blocks (gpu_0/pre_merge/unit-or-integration/planner). * Section 5.6 cross-cutting-fix SHA: ca10f72 -> 4ffe1dc. Added note that the 5 rebase fixups follow the same fan-out pattern. * Section 2.6 and section 6.1: refreshed historical commit-SHA citations (43d81ba was 7319c9c; 52848a0 was 688c30c). * Section 7 pre-flight: added the section 1.6 cross-reference and the Windows pytest-marker-report fcntl caveat (passes on Linux). No strategic changes; PR 1a / PR 1b / PR 2 / PR 3 / PR 4 / PR 5 scope and mechanics are unchanged. Signed-off-by: Kai Ma <[email protected]>
…ebase Main's #9246 (chore: suffix duration config fields with units) renamed PlannerConfig.ttft -> ttft_ms and PlannerConfig.itl -> itl_ms. Construction keeps working via pydantic's validation_alias=AliasChoices("ttft_ms", "ttft"), so PlannerConfig(ttft=..., itl=...) keyword construction is still accepted, but Python attribute access must use the new names. PR 9369 was based on the pre-rename code and read the SLAs via .ttft / .itl on PlannerConfig instances: - aic_power_optimizer.py: 2 reads (single-engine feasibility check) + 2 reads (should_reoptimize SLA-violation check) - test_aic_real_data.py: 1 read (synthesizing 2x-SLA traffic) All 4 + 1 sites updated. Surfaced as AttributeError when running the 26 alpha-class testbed scenarios (test_scenarios.py::test_alpha[*]). Fixes: 26 testbed alpha-scenario failures, 1 test_self_consistency alpha test Signed-off-by: Kai Ma <[email protected]>
Rebase onto main pulled in PR #9246's PlannerConfig field renames ( tft-> tft_ms, itl->itl_ms, hroughput_adjustment_interval-> hroughput_adjustment_interval_seconds, load_adjustment_interval->load_adjustment_interval_seconds). Two of the four ms-suffix accesses were updated in the prior fixup, but power_aware_replay_adapter.py still accessed the old hroughput_adjustment_interval attribute. Pydantic's AliasChoices only covers constructor input, not attribute access — so all four gamma-class testbed tests failed with:: AttributeError: 'PlannerConfig' object has no attribute 'throughput_adjustment_interval'. Did you mean: 'throughput_adjustment_interval_seconds'? This patch renames the attribute access at line 111 to the new canonical field name. Constructor sites still work via AliasChoices. Signed-off-by: Kai Ma <[email protected]>
…ebase Main's #9246 (chore: suffix duration config fields with units) renamed PlannerConfig.ttft -> ttft_ms and PlannerConfig.itl -> itl_ms. Construction keeps working via pydantic's validation_alias=AliasChoices("ttft_ms", "ttft"), so PlannerConfig(ttft=..., itl=...) keyword construction is still accepted, but Python attribute access must use the new names. PR 9369 was based on the pre-rename code and read the SLAs via .ttft / .itl on PlannerConfig instances: - aic_power_optimizer.py: 2 reads (single-engine feasibility check) + 2 reads (should_reoptimize SLA-violation check) - test_aic_real_data.py: 1 read (synthesizing 2x-SLA traffic) All 4 + 1 sites updated. Surfaced as AttributeError when running the 26 alpha-class testbed scenarios (test_scenarios.py::test_alpha[*]). Fixes: 26 testbed alpha-scenario failures, 1 test_self_consistency alpha test Signed-off-by: Kai Ma <[email protected]>
Rebase onto main pulled in PR #9246's PlannerConfig field renames ( tft-> tft_ms, itl->itl_ms, hroughput_adjustment_interval-> hroughput_adjustment_interval_seconds, load_adjustment_interval->load_adjustment_interval_seconds). Two of the four ms-suffix accesses were updated in the prior fixup, but power_aware_replay_adapter.py still accessed the old hroughput_adjustment_interval attribute. Pydantic's AliasChoices only covers constructor input, not attribute access — so all four gamma-class testbed tests failed with:: AttributeError: 'PlannerConfig' object has no attribute 'throughput_adjustment_interval'. Did you mean: 'throughput_adjustment_interval_seconds'? This patch renames the attribute access at line 111 to the new canonical field name. Constructor sites still work via AliasChoices. Signed-off-by: Kai Ma <[email protected]>
Summary
PlannerConfigand the global router so units are visible in the field name itself (no more reading comments to know if a number is ms, seconds, or hours).Renames
PlannerConfig/SLAPlannerDefaultsttft→ttft_msitl→itl_msthroughput_adjustment_interval→throughput_adjustment_interval_secondsload_adjustment_interval→load_adjustment_interval_secondsGlobal router (
pool_selection.py/backend_args.py)ttft_min/ttft_max→ttft_min_ms/ttft_max_msitl_min/itl_max→itl_min_ms/itl_max_msdefault_ttft_target/default_itl_target→*_ms(CLI:--default-{ttft,itl}-target-ms)select_pool(...)params updated to match.Backwards compatibility
PlannerConfiguses pydanticField(validation_alias=AliasChoices(new, old))so old keys still parse._get_aliased()helper that falls back to the old key with a one-line deprecation warning.obsolete_flagaliases of the new flags.Intentionally untouched
Metricsclass fields (ttft,itl) — observed runtime metrics, not config.sla.ttft/sla.itl— separate user-facing CRD schema.extra_args["ttft_target"]/extra_args["itl_target"]— runtime client API.Test plan
pytest components/src/dynamo/planner/tests/unit/{test_planner_config,test_easy_scaling,test_state_machine,test_diagnostics_recorder,test_metric_publication,test_load_based_scaling,test_load_predictors}.py— 172 passpytest components/src/dynamo/global_router/tests/— 52 pass (the existing JSON-fixture tests use old names and now exercise the alias path)PlannerConfig.from_config_arg(...)and global routerload_config(...)with both old-style and new-style keys; both produce identical configs, with deprecation warnings on the old path.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Refactor
_msfor milliseconds,_secondsfor seconds). Examples:ttft→ttft_ms,throughput_adjustment_interval→throughput_adjustment_interval_seconds. Legacy parameter names remain supported for backward compatibility.Documentation