Skip to content

Commit

Permalink
Add per-pool queue limit overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
severinson committed Jun 22, 2023
1 parent 11443f7 commit 9698ea6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions internal/armada/configuration/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ type PriorityClass struct {
// jobs of this priority class are not scheduled if doing so would cause the total resources assigned
// to jobs of priority 10 or lower from the same queue to exceed 30% of the total.
MaximumResourceFractionPerQueue map[string]float64
// Per-pool override of MaximumResourceFractionPerQueue.
// If missing for a particular pool, MaximumResourceFractionPerQueue is used instead for that pool.
MaximumResourceFractionPerQueueByPool map[string]map[string]float64
}

func (p PreemptionConfig) PriorityByPriorityClassName() map[string]int32 {
Expand Down
2 changes: 1 addition & 1 deletion internal/armada/server/submit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ func withSubmitServerAndRepos(action func(s *SubmitServer, jobRepo repository.Jo
MaxPodSpecSizeBytes: 65535,
Preemption: configuration.PreemptionConfig{
DefaultPriorityClass: "high",
PriorityClasses: map[string]configuration.PriorityClass{"high": {0, false, nil}},
PriorityClasses: map[string]configuration.PriorityClass{"high": {0, false, nil, nil}},
},
MinTerminationGracePeriod: time.Duration(30 * time.Second),
MaxTerminationGracePeriod: time.Duration(300 * time.Second),
Expand Down
8 changes: 4 additions & 4 deletions internal/scheduler/adapters/adapters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (

var (
priorityByPriorityClassName = map[string]configuration.PriorityClass{
"priority-0": {0, true, nil},
"priority-1": {1, true, nil},
"priority-2": {2, true, nil},
"priority-3": {3, false, nil},
"priority-0": {0, true, nil, nil},
"priority-1": {1, true, nil, nil},
"priority-2": {2, true, nil, nil},
"priority-3": {3, false, nil, nil},
}

priority int32 = 1
Expand Down
12 changes: 9 additions & 3 deletions internal/scheduler/constraints/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,21 @@ func SchedulingConstraintsFromSchedulingConfig(
) SchedulingConstraints {
priorityClassSchedulingConstraintsByPriorityClassName := make(map[string]PriorityClassSchedulingConstraints, len(config.Preemption.PriorityClasses))
for name, priorityClass := range config.Preemption.PriorityClasses {
maximumResourceFractionPerQueue := priorityClass.MaximumResourceFractionPerQueue
if m, ok := priorityClass.MaximumResourceFractionPerQueueByPool[pool]; ok {
// Use pool-specific config is available.
maximumResourceFractionPerQueue = m
}
priorityClassSchedulingConstraintsByPriorityClassName[name] = PriorityClassSchedulingConstraints{
PriorityClassName: name,
PriorityClassPriority: priorityClass.Priority,
MaximumCumulativeResourcesPerQueue: absoluteFromRelativeLimits(totalResources, priorityClass.MaximumResourceFractionPerQueue),
MaximumCumulativeResourcesPerQueue: absoluteFromRelativeLimits(totalResources, maximumResourceFractionPerQueue),
}
}
maximumResourceFractionToSchedule := config.MaximumResourceFractionToSchedule
if limit, ok := config.MaximumResourceFractionToScheduleByPool[pool]; ok {
maximumResourceFractionToSchedule = limit
if m, ok := config.MaximumResourceFractionToScheduleByPool[pool]; ok {
// Use pool-specific config is available.
maximumResourceFractionToSchedule = m
}
return SchedulingConstraints{
MaximumJobsToSchedule: config.MaximumJobsToSchedule,
Expand Down

0 comments on commit 9698ea6

Please sign in to comment.