flavorassigner

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	PodSets   []PodSetAssignment
	Borrowing bool
	LastState workload.AssignmentClusterQueueState

	// Usage is the accumulated Usage of resources as pod sets get
	// flavors assigned.
	Usage resources.FlavorResourceQuantities
	// contains filtered or unexported fields
}

func (*Assignment) Borrows

func (a *Assignment) Borrows() bool

Borrows return whether assignment requires borrowing.

func (*Assignment) Message

func (a *Assignment) Message() string

func (*Assignment) RepresentativeMode

func (a *Assignment) RepresentativeMode() FlavorAssignmentMode

RepresentativeMode calculates the representative mode for the assignment as the worst assignment mode among all the pod sets.

func (*Assignment) ToAPI

func (a *Assignment) ToAPI() []kueue.PodSetAssignment

func (*Assignment) TotalRequestsFor added in v0.7.0

func (a *Assignment) TotalRequestsFor(wl *workload.Info) resources.FlavorResourceQuantities

TotalRequestsFor - returns the total quota needs of the wl, taking into account the potential scaling needed in case of partial admission.

type FlavorAssigner added in v0.7.0

type FlavorAssigner struct {
	// contains filtered or unexported fields
}

func New added in v0.7.0

func New(wl *workload.Info, cq *cache.ClusterQueueSnapshot, resourceFlavors map[kueue.ResourceFlavorReference]*kueue.ResourceFlavor, enableFairSharing bool, oracle preemptionOracle) *FlavorAssigner

func (*FlavorAssigner) Assign added in v0.7.0

func (a *FlavorAssigner) Assign(log logr.Logger, counts []int32) Assignment

Assign assigns a flavor to each of the resources requested in each pod set. The result for each pod set is accompanied with reasons why the flavor can't be assigned immediately. Each assigned flavor is accompanied with a FlavorAssignmentMode.

type FlavorAssignment

type FlavorAssignment struct {
	Name           kueue.ResourceFlavorReference
	Mode           FlavorAssignmentMode
	TriedFlavorIdx int
	// contains filtered or unexported fields
}

type FlavorAssignmentMode

type FlavorAssignmentMode int

FlavorAssignmentMode describes whether the flavor can be assigned immediately or what needs to happen, so it can be assigned.

const (
	// NoFit means that there is not enough quota to assign this flavor.
	NoFit FlavorAssignmentMode = iota
	// Preempt means that there is not enough unused nominal quota in the ClusterQueue
	// or cohort. Preempting other workloads in the ClusterQueue or cohort, or
	// waiting for them to finish might make it possible to assign this flavor.
	Preempt
	// Fit means that there is enough unused quota in the cohort to assign this
	// flavor.
	Fit
)

The flavor assignment modes below are ordered from lowest to highest preference.

func (FlavorAssignmentMode) String

func (m FlavorAssignmentMode) String() string

type PodSetAssignment

type PodSetAssignment struct {
	Name     string
	Flavors  ResourceAssignment
	Status   *Status
	Requests corev1.ResourceList
	Count    int32

	TopologyAssignment *kueue.TopologyAssignment
}

PodSetAssignment holds the assigned flavors and status messages for each of the resources that the pod set requests. Each assigned flavor is accompanied with an AssignmentMode. Empty .Flavors can be interpreted as NoFit mode for all the resources. Empty .Status can be interpreted as Fit mode for all the resources. .Flavors and .Status can't be empty at the same time, once PodSetAssignment is fully calculated.

func (*PodSetAssignment) RepresentativeMode

func (psa *PodSetAssignment) RepresentativeMode() FlavorAssignmentMode

RepresentativeMode calculates the representative mode for this assignment as the worst assignment mode among all assigned flavors.

type PodSetReducer added in v0.4.0

type PodSetReducer[R any] struct {
	// contains filtered or unexported fields
}

PodSetReducer helper structure used to gradually walk down from PodSets[*].Count to *PodSets[*].MinimumCount.

func NewPodSetReducer added in v0.4.0

func NewPodSetReducer[R any](podSets []kueue.PodSet, fits func([]int32) (R, bool)) *PodSetReducer[R]

func (*PodSetReducer[R]) Search added in v0.4.0

func (psr *PodSetReducer[R]) Search() (R, bool)

Search find the first biggest set of counts that pass fits(), it's using binary Search so the last call to fits() might not be a successful one Returns nil if no solution was found

type ResourceAssignment

type ResourceAssignment map[corev1.ResourceName]*FlavorAssignment

type Status

type Status struct {
	// contains filtered or unexported fields
}

func (*Status) Equal

func (s *Status) Equal(o *Status) bool

func (*Status) IsError

func (s *Status) IsError() bool

func (*Status) Message

func (s *Status) Message() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL