Skip to content

Commit

Permalink
add preemptBasedOnFlavorOrder knob
Browse files Browse the repository at this point in the history
  • Loading branch information
KunWuLuan committed Apr 27, 2023
1 parent 9ca57c8 commit 2d998f4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apis/kueue/v1beta1/clusterqueue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ type ClusterQueuePreemption struct {
// +kubebuilder:default=Never
// +kubebuilder:validation:Enum=Never;LowerPriority
WithinClusterQueue PreemptionPolicy `json:"withinClusterQueue,omitempty"`

// +kubebuilder:default="flase"
PreemptBasedOnFlavorOrder bool `json:"preemptBasedOnFlavorOrder"`
}

//+kubebuilder:object:root=true
Expand Down
5 changes: 5 additions & 0 deletions config/components/crd/bases/kueue.x-k8s.io_clusterqueues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ spec:
of Workloads to preempt to accomomdate the pending Workload, preempting
Workloads with lower priority first."
properties:
preemptBasedOnFlavorOrder:
default: flase
type: boolean
reclaimWithinCohort:
default: Never
description: "reclaimWithinCohort determines whether a pending
Expand Down Expand Up @@ -159,6 +162,8 @@ spec:
- Never
- LowerPriority
type: string
required:
- preemptBasedOnFlavorOrder
type: object
queueingStrategy:
default: BestEffortFIFO
Expand Down
3 changes: 3 additions & 0 deletions pkg/scheduler/flavorassigner/flavorassigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,9 @@ func (a *Assignment) findFlavorForResourceGroup(
}
}

if cq.Preemption.PreemptBasedOnFlavorOrder && representativeMode == Preempt {
return assignments, status
}
if representativeMode > bestAssignmentMode {
bestAssignment = assignments
bestAssignmentMode = representativeMode
Expand Down

0 comments on commit 2d998f4

Please sign in to comment.