flavorassigner

package
v0.6.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 17 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.AssigmentClusterQueueState

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

func AssignFlavors

func AssignFlavors(log logr.Logger, wl *workload.Info, resourceFlavors map[kueue.ResourceFlavorReference]*kueue.ResourceFlavor, cq *cache.ClusterQueue, counts []int32) Assignment

AssignFlavors 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.

func (*Assignment) Borrows

func (a *Assignment) Borrows() bool

Borrows return whether assigment 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 assigment as the worst assignment mode among all the pod sets.

func (*Assignment) ToAPI

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

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 CluserQueue 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 assigment 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
}

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