feat(scheduler): capacitycost node scorer + capacityUpgrade rescheduling strategy - #25
Merged
Merged
Conversation
…uling strategy capacitycost ranks nodes by a static capacity-type order (reserved < spot < on-demand by default, read from karpenter.sh/capacity-type) and scores GPU tasks toward the cheapest tier, so placement and preemption prefer already-paid-for capacity over binpacking onto a fuller expensive node. capacityUpgrade is a rescheduling strategy that moves running GPU work down to a cheaper tier once it fits there, counting strictly lower-priority pods on the target as room the preempt action will free. Single-member PodGroups are evicted directly; multi-member gangs get an exa.ai/capacity-upgrade proposal on their PodGroup for the lifecycle owner to execute atomically. Dry-run by default, with cooldown, min pod age, priority ceiling, opt-out label, per-pass budgets and metrics. Assisted-by: Devin:claude
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
What type of PR is this?
/kind feature
What this PR does / why we need it:
Two pieces that make the scheduler prefer cheaper capacity tiers, sharing one static rank read from a node label (
karpenter.sh/capacity-type, orderreserved,spot,on-demandby default; unlabeled nodes rank 0).capacitycostplugin (pkg/scheduler/plugins/capacitycost) — aNodeOrderFnfor GPU tasks:At the default
capacitycost.weight: 20a rank-0 node gets +2000 over a rank-2 node, above binpack's reach, so a Pending GPU task lands on (andpreemptlooks first at) the cheapest tier that passes predicates. Args:capacitycost.weight,.nodeLabelKey,.order,.unlabeledRank,.resource(""scores every task).capacityUpgraderescheduling strategy (pkg/scheduler/plugins/rescheduling/capacity_upgrade.go) — runs under the existingreschedulingplugin /shuffleaction next togpuFragmentation. Per pass:minPodAgeSeconds, priority ≤maxVictimPriority, no<optOutLabel>=false, at least one member above rank 0, cooldown (exa.ai/capacity-upgrade-last) expired. Ordered highest priority → oldest.preemptwould evict for this group), with the group's own members counted as freeable. Gangs must fit inside onezoneLabelvalue. Predicates run throughPrePredicateFn/PredicateFn, with pod (anti-)affinity relaxed for gang probes since the planner enforces the zone itself.capacity-upgrade-last,repack-evictions=1) and returned as victims; the controller recreates the pod and the scorer places it. Multi-member gangs are not evicted: the PodGroup gets a JSON proposal onexa.ai/capacity-upgrade({target, from, zone, nodes, members, gpus, preempting, at}) for the gang's lifecycle owner to act on with its own gates (checkpoint age, user opt-out, …).dryRun: trueby default, logs the would-be moves and counts them. Budgets:maxVictims(8),maxGangProposals(2). Kill switchEXA_CAPACITY_UPGRADE_DISABLED=true. Metrics:volcano_capacity_upgrade_{passes,moves,pods,gpus}_total{target,kind=pod|gang,mode=dry_run|proposed|live},..._stamp_failures_total{kind}.Example scheduler config:
Which issue(s) this PR fixes:
N/A
Special notes for your reviewer:
preemptwill evict lower-priority pods on the target node for the recreated task. That holds when the preemptor and victims are both scheduler-managed (the fork's podgroup controller wraps ReplicaSets, so Deployment pods qualify); dry-run output should be compared with actual preemptions before flipping live.go test ./pkg/scheduler/plugins/capacitycost/ ./pkg/scheduler/plugins/rescheduling/(13 new cases: single pod idle fit, filler-as-room, priority ceiling, single-zone gang, predicate veto, cooldown/age/opt-out/do-not-disrupt gates, ledger double-booking, ordering, budgets, mixed gang, config parsing).go build ./pkg/scheduler/...,go vet,gofmtclean.Does this PR introduce a user-facing change?
Link to Devin session: https://app.devin.ai/sessions/10aaaafe5fa84b90af9ad613fb6a3b6f
Open in Devin Desktop: https://app.devin.ai/desktop/session/10aaaafe5fa84b90af9ad613fb6a3b6f?variant=devin
Requested by: @pfernandes21