Repository navigation
Conversation
This was referenced May 18, 2026
kaim-eng
force-pushed
the
pr1b/planner-infra
branch
from
May 18, 2026 16:03
2222dbf to
1d7b243
Compare
kaim-eng
force-pushed
the
pr2/power-budget
branch
from
May 18, 2026 16:04
d32fbdb to
739bed9
Compare
Adds the Power Agent DaemonSet (privileged, hostPID) that watches pods
for the dynamo.nvidia.com/gpu-power-limit annotation, parses
/proc/{pid}/cgroup to recover pod UIDs (handles all K8s QoS x cgroup
driver x CRI runtime variants), and calls
nvmlDeviceSetPowerManagementLimit per physical GPU.
Includes NVML cap clamping to SKU-specific [min_w, max_w] bounds,
UUID-gated orphan-cap restoration on startup, SIGTERM-handler default-
TGP restore, and a multi-pod-per-GPU policy that falls back to
power_agent_safe_default_watts on conflict.
43 unit tests covering apply_cap, cgroup_parser, multi_pod_policy,
shutdown. Standalone component - no coupling to planner internals.
CI filter (.github/filters.yaml) extends the planner group to cover the
new component + deploy paths so changes here trip the planner job set.
Part of the PR #9369 split (PR 1a of 6). See docs/design-docs/pr9369-split-plan.md.
Signed-off-by: Kai Ma <[email protected]>
kaim-eng
force-pushed
the
pr1b/planner-infra
branch
from
May 19, 2026 12:57
1d7b243 to
8126b1a
Compare
kaim-eng
force-pushed
the
pr2/power-budget
branch
from
May 19, 2026 12:58
739bed9 to
7be3a27
Compare
Folds deploy/power_agent/{daemonset,rbac,dev-pod}.yaml into a single
Helm chart at deploy/helm/charts/power-agent/, resolving the three
CodeRabbit findings on PR #9682:
* hardcoded metadata.namespace=default -> {{ .Release.Namespace }}
* mutable image :latest -> required image.tag with fail-fast validator
* `${POWER_AGENT_NAMESPACE}` envsubst placeholder -> native Helm templating
The chart supports three deployment shapes selectable via values:
production DaemonSet (default, cluster-wide RBAC), namespace-restricted
production (Role+RoleBinding), and an in-cluster dev-iteration Pod
mounting power_agent.py from a ConfigMap. Three template-time validators
reject foot-guns at install time: empty image.tag, mutex violations
between daemonset.enabled and dev.enabled, and dev mode without a
pinned dev.nodeName. Dev mode also automatically forces namespace-scoped
RBAC (least privilege), leveraging power_agent.py's --namespace flag.
Design rationale, scope decisions, and review-feedback responses are
captured in docs/design-docs/power-agent-helm-chart-plan.md, committed
alongside the chart.
components/power_agent/README.md flips its install recipe to
``helm install``, and the planner CI filter (.github/filters.yaml) is
retargeted from deploy/power_agent/** to deploy/helm/charts/power-agent/**.
Two examples/deployments/powerplanner/*.yaml header references live on
PR #9687 and will be updated during that PR's cascade rebase per plan
section 5.3.
Validated locally:
helm lint -> 0 errors
helm template (3 positive exercises) -> expected resources
helm template (3 negative exercises) -> expected fail-fast errors
components/power_agent/tests/ -> 43/43 passed
.github/scripts/test-filters.js -> 20/20 passed
pre-commit (cross-cutting hooks) -> all applicable passed
Signed-off-by: Kai Ma <[email protected]>
…S.txt copyright-checks (regex requiring `#`-prefixed SPDX lines) rejected the Go-template-comment header in _helpers.tpl and the missing header in NOTES.txt on commit 8e490a7. Switch both to the same 2-line `#`-prefixed form already used by the other 9 chart files, aligning with @grahamking's PR review preference (minimal SPDX, no Apache boilerplate). For NOTES.txt this adds two visible lines to the post-`helm install` banner, matching the project convention established by deploy/helm/charts/platform/templates/NOTES.txt. For _helpers.tpl the header sits outside any `{{- define -}}` block, so it is never invoked at render time and is invisible to consumers despite not being inside a Go template comment. Re-validated locally: helm lint -> 0 errors helm template (default mode) -> 4 expected kinds pre-commit on the two touched files -> all applicable hooks pass Signed-off-by: Kai Ma <[email protected]>
…rometheus Adds the planner-side mechanism for power-aware operation: - 5 PlannerConfig fields (enable_power_awareness defaults False) with required-when-enabled validator for total_gpu_power_limit and power_agent_safe_default_watts - _apply_power_annotations() reconciliation loop on every tick, gated on the feature flag, with POWER_ANNOTATION_KEY constant - _publish_power_budget_metrics() dashboard gauges (static config, not DCGM, so it remains valid when attribution drops) - CoreV1Api + patch_pod_annotation + list_pods_by_label on KubernetesAPI - get_component_pods + list_frontend_pods + resolve_frontend_http_port on KubernetesConnector - get_total_dgd_power DCGM Prometheus query + NaN-filter fix on the frontend-source path - 3 planner_metrics gauges: power_budget_total_watts, power_projected_watts, power_budget_utilization - Operator Helm chart bump 1.2.0 -> 1.2.1 with planner pod-RBAC patch (pods: get/list/watch/patch) plus deploy/planner-pod-rbac-dev.yaml for non-operator development clusters - repo-shared components/src/conftest.py (planner pkg conftest) - 623-line unit suite (test_actuation_knobs.py) + 567-line live integration suite (test_actuation_knobs_live.py) covering every actuation knob this PR adds - Unit test additions on test_kubernetes_connector.py (~119 lines) and test_prometheus.py (NaN tests + TestPowerAwareDcgmQueries get_total_dgd_power subset, ~100 lines) - CI filter (.github/filters.yaml) extends the planner group with components/src/conftest.py Power awareness is off by default. Budget enforcement (_apply_power_budget) and the AIC closed loop arrive in PR 2 and PR 3. Part of the PR #9369 split (PR 1b of 6). Predecessor PR 1a (power-agent component) must merge first or land in parallel. See docs/design-docs/pr9369-split-plan.md. Signed-off-by: Kai Ma <[email protected]>
Adds _apply_power_budget() to PlannerStateMachine, wired into both load-scaling and throughput-scaling paths (one-line call site each). Budget enforcement runs only when enable_power_awareness=True and total_gpu_power_limit is set, so it is a no-op on existing deployments. Includes a no-upscale-decode invariant in _apply_global_budget: when proportional_clamp_pair (from main's budget helper, see PR #9296) would allocate decode beyond original demand because prefill is the binding constraint, decode is clamped back to min(num_d, min_endpoint). This preserves the original behavioural contract from the pre-rebase inline formula while delegating to main's shared clamp. 68-line TestApplyGlobalBudgetNoUpscale suite (5 tests) pins the no-upscale invariant. Part of the PR #9369 split (PR 2 of 6). See docs/design-docs/pr9369-split-plan.md. Signed-off-by: Kai Ma <[email protected]>
kaim-eng
force-pushed
the
pr1b/planner-infra
branch
from
May 19, 2026 15:54
8126b1a to
f7f3226
Compare
kaim-eng
force-pushed
the
pr2/power-budget
branch
from
May 19, 2026 15:55
7be3a27 to
0c9050c
Compare
kaim-eng
force-pushed
the
pr1b/planner-infra
branch
from
May 25, 2026 14:17
7696f3f to
8f47413
Compare
kaim-eng
force-pushed
the
pr1b/planner-infra
branch
2 times, most recently
from
June 8, 2026 16:41
35716ac to
b1ebd8b
Compare
kaim-eng
force-pushed
the
pr1b/planner-infra
branch
9 times, most recently
from
July 14, 2026 20:04
b9c0068 to
f0d4475
Compare
kaim-eng
added a commit
that referenced
this pull request
Jul 24, 2026
Summary ------- Rework the power feature so the Planner READS per-GPU caps from DGD worker podTemplate annotations (dynamo.nvidia.com/gpu-power-limit) and clamps replica scaling against a total power budget, instead of owning/PATCHing per-Pod caps. Supersedes the Planner-owned Pod-PATCH stack (#9683-#9685). - Caps are authored on worker podTemplate annotations, applied to Pods by the operator, and enforced by the Power Agent; the Planner only reads them. - DGD parsing: Service.get_gpu_power_limit_watts, ComponentPowerConfig, resolve_component_power_configs (disagg + agg via the generic type:worker fallback), positive-int GPU/nodeCount validation. - Config: remove Planner-owned per-GPU write fields (rejected via a migration validator); require environment=kubernetes when awareness is on. - Deployment state/capabilities carry resolved per-replica watts and a deployment-scoped scale-up-blocked flag. Init is strict/fail-closed; runtime is conservative (keep last-good, hold the per-role max, block scale-up on a changed/malformed cap or a transient apiserver error). - Projection gauges read cached state; final budget boundary applies GPU budget then power budget (ceiling-only clamp, decode-no-upscale, partial-proposal masks; power wins over the GPU floor), plus a startup min-footprint gate. While ANY power-relevant role is mid-rollout the Kubernetes environment marks BOTH roles' settled target unknown (one deployment-wide stability flag), so every role's scale-up is held at its ready count -- keyed off rollout state, not None targets, since the merge fills every role. The projection then masks any target equal to its ready count back to None, so a held scale-up emits nothing and a scale-down of one role does not drag the other role's echoed ready count along (DisaggPlanner applies every non-None target as the new DGD desired); the in-flight rollout's desired is left untouched and a proposal cannot admit an over-budget settled state. - Remove the Pod sweep/PATCH machinery, pods/patch RBAC, and superseded frontend scaffolding (get_component_pods / list_frontend_pods / post_busy_threshold); the baseline get_frontend_metrics_url is retained. Correct Power Agent ownership docstrings. Add example + docs. The budget is a projected ceiling over the requested caps, not a proven hardware limit; effective-cap feedback is deferred to a dynamic-control design. Validation ---------- - 555 planner tests pass (unit suite + mocked no-mutation integration gate); black/isort/ruff/flake8 clean. (The broader plugins/offline test trees need grpc/aiconfigurator, absent in this env, and are unaffected by this change.) - Cut fresh from origin/main; power-only diff -- no aggregate name-plumbing (the generic type:worker fallback and the power resolver are kept). Refs #9683, #9684, #9685 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Kai Ma <[email protected]>
kaim-eng
added a commit
that referenced
this pull request
Jul 28, 2026
Summary ------- Rework the power feature so the Planner READS per-GPU caps from DGD worker podTemplate annotations (dynamo.nvidia.com/gpu-power-limit) and clamps replica scaling against a total power budget, instead of owning/PATCHing per-Pod caps. Supersedes the Planner-owned Pod-PATCH stack (#9683-#9685). - Caps are authored on worker podTemplate annotations, applied to Pods by the operator, and enforced by the Power Agent; the Planner only reads them. - DGD parsing: Service.get_gpu_power_limit_watts, ComponentPowerConfig, resolve_component_power_configs (disagg + agg via the generic type:worker fallback), positive-int GPU/nodeCount validation. - Config: remove Planner-owned per-GPU write fields (rejected via a migration validator); require environment=kubernetes when awareness is on. - Deployment state/capabilities carry resolved per-replica watts and a deployment-scoped scale-up-blocked flag. Init is strict/fail-closed; runtime is conservative (keep last-good, hold the per-role max, block scale-up on a changed/malformed cap or a transient apiserver error). - Projection gauges read cached state; final budget boundary applies GPU budget then power budget (ceiling-only clamp, decode-no-upscale, partial-proposal masks; power wins over the GPU floor), plus a startup min-footprint gate. While ANY power-relevant role is mid-rollout the Kubernetes environment marks BOTH roles' settled target unknown (one deployment-wide stability flag), so every role's scale-up is held at its ready count -- keyed off rollout state, not None targets, since the merge fills every role. The projection then masks any target equal to its ready count back to None, so a held scale-up emits nothing and a scale-down of one role does not drag the other role's echoed ready count along (DisaggPlanner applies every non-None target as the new DGD desired); the in-flight rollout's desired is left untouched and a proposal cannot admit an over-budget settled state. - Remove the Pod sweep/PATCH machinery, pods/patch RBAC, and superseded frontend scaffolding (get_component_pods / list_frontend_pods / post_busy_threshold); the baseline get_frontend_metrics_url is retained. Correct Power Agent ownership docstrings. Add example + docs. The budget is a projected ceiling over the requested caps, not a proven hardware limit; effective-cap feedback is deferred to a dynamic-control design. Validation ---------- - 555 planner tests pass (unit suite + mocked no-mutation integration gate); black/isort/ruff/flake8 clean. (The broader plugins/offline test trees need grpc/aiconfigurator, absent in this env, and are unaffected by this change.) - Cut fresh from origin/main; power-only diff -- no aggregate name-plumbing (the generic type:worker fallback and the power resolver are kept). Refs #9683, #9684, #9685 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Kai Ma <[email protected]>
kaim-eng
added a commit
that referenced
this pull request
Jul 30, 2026
Summary ------- Rework the power feature so the Planner READS per-GPU caps from DGD worker podTemplate annotations (dynamo.nvidia.com/gpu-power-limit) and clamps replica scaling against a total power budget, instead of owning/PATCHing per-Pod caps. Supersedes the Planner-owned Pod-PATCH stack (#9683-#9685). - Caps are authored on worker podTemplate annotations, applied to Pods by the operator, and enforced by the Power Agent; the Planner only reads them. - DGD parsing: Service.get_gpu_power_limit_watts, ComponentPowerConfig, resolve_component_power_configs (disagg + agg via the generic type:worker fallback), positive-int GPU/nodeCount validation. - Config: remove Planner-owned per-GPU write fields (rejected via a migration validator); require environment=kubernetes when awareness is on. - Deployment state/capabilities carry resolved per-replica watts and a deployment-scoped scale-up-blocked flag. Init is strict/fail-closed; runtime is conservative (keep last-good, hold the per-role max, block scale-up on a changed/malformed cap or a transient apiserver error). - Projection gauges read cached state; final budget boundary applies GPU budget then power budget (ceiling-only clamp, decode-no-upscale, partial-proposal masks; power wins over the GPU floor), plus a startup min-footprint gate. While ANY power-relevant role is mid-rollout the Kubernetes environment marks BOTH roles' settled target unknown (one deployment-wide stability flag), so every role's scale-up is held at its ready count -- keyed off rollout state, not None targets, since the merge fills every role. The projection then masks any target equal to its ready count back to None, so a held scale-up emits nothing and a scale-down of one role does not drag the other role's echoed ready count along (DisaggPlanner applies every non-None target as the new DGD desired); the in-flight rollout's desired is left untouched and a proposal cannot admit an over-budget settled state. - Remove the Pod sweep/PATCH machinery, pods/patch RBAC, and superseded frontend scaffolding (get_component_pods / list_frontend_pods / post_busy_threshold); the baseline get_frontend_metrics_url is retained. Correct Power Agent ownership docstrings. Add example + docs. The budget is a projected ceiling over the requested caps, not a proven hardware limit; effective-cap feedback is deferred to a dynamic-control design. Validation ---------- - 555 planner tests pass (unit suite + mocked no-mutation integration gate); black/isort/ruff/flake8 clean. (The broader plugins/offline test trees need grpc/aiconfigurator, absent in this env, and are unaffected by this change.) - Cut fresh from origin/main; power-only diff -- no aggregate name-plumbing (the generic type:worker fallback and the power resolver are kept). Refs #9683, #9684, #9685 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Kai Ma <[email protected]>
Contributor
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Contributor
|
This PR has been closed due to inactivity. If you believe this PR is still relevant, please feel free to reopen it with additional context or information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the PR #9369 split plan.
This is PR 3 of 6 (PR 2 — Power Budget Enforcement). Held in Draft per plan §4.5 until PR 1a + PR 1b are approved.
Predecessor: #9683 — Planner power infrastructure
Successor: #9685 (Draft) — AIC closed-loop optimizer
Scope
Budget clamping works, opt-in via config. Adds
_apply_power_budget()to the state machine, wired into both load- and throughput-scaling paths. Includes the decode-no-upscale clamp in_apply_global_budget()(3-line post-proportional_clamp_pairinvariant — see plan §2.3 for the post-rebase mechanic note).~1,200 lines · 4 files. Budget is only active when
enable_power_awareness=Trueandtotal_gpu_power_limitis set.core/state_machine.py—_apply_power_budget()method (66 LOC) + decode-no-upscale clamp in_apply_global_budget()core/load_scaling.py/core/throughput_scaling.py— 1-line call sitestests/unit/test_state_machine.py—TestApplyGlobalBudgetNoUpscaleclass (5 tests, 68 LOC)Reviewer onboarding
docs/design-docs/powerplanner-design.md§6.1 (budget clamping), §6.2 (decode-no-upscale invariant)Tests at this tip (projection per plan §4.4 — will re-measure on dev pod before marking Ready for Review)
TestApplyGlobalBudgetNoUpscale— 5 passedMerge strategy
Rebase-and-merge (no squash). Mark Ready for Review only after both PR 1a and PR 1b have approvals, and rebase onto whichever predecessor lands first.