util

package
Version: v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0 Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildNode

func BuildNode(name string, alloc v1.ResourceList, labels map[string]string) *v1.Node

BuildNode builts node object

func BuildPod

func BuildPod(namespace, name, nodename string, p v1.PodPhase, req v1.ResourceList, groupName string, labels map[string]string, selector map[string]string) *v1.Pod

BuildPod builts Pod object

func BuildResourceList

func BuildResourceList(cpu string, memory string) v1.ResourceList

BuildResourceList builts resource list object

func BuildResourceListWithGPU

func BuildResourceListWithGPU(cpu string, memory string, GPU string) v1.ResourceList

BuildResourceListWithGPU builts resource list with GPU

func CalculateNumOfFeasibleNodesToFind

func CalculateNumOfFeasibleNodesToFind(numAllNodes int32) (numNodes int32)

CalculateNumOfFeasibleNodesToFind returns the number of feasible nodes that once found, the scheduler stops its search for more feasible nodes.

func GetMinInt added in v1.2.0

func GetMinInt(vals ...int) int

GetMinInt return minimum int from vals

func GetNodeList

func GetNodeList(nodes map[string]*api.NodeInfo, nodeList []string) []*api.NodeInfo

GetNodeList returns values of the map 'nodes'

func PredicateNodes

func PredicateNodes(task *api.TaskInfo, nodes []*api.NodeInfo, fn api.PredicateFn) ([]*api.NodeInfo, *api.FitErrors)

PredicateNodes returns the specified number of nodes that fit a task

func PrioritizeNodes

func PrioritizeNodes(task *api.TaskInfo, nodes []*api.NodeInfo, batchFn api.BatchNodeOrderFn, mapFn api.NodeOrderMapFn, reduceFn api.NodeOrderReduceFn) map[float64][]*api.NodeInfo

PrioritizeNodes returns a map whose key is node's score and value are corresponding nodes

func SelectBestNode

func SelectBestNode(nodeScores map[float64][]*api.NodeInfo) *api.NodeInfo

SelectBestNode returns best node whose score is highest, pick one randomly if there are many nodes with same score.

func SortNodes

func SortNodes(nodeScores map[float64][]*api.NodeInfo) []*api.NodeInfo

SortNodes returns nodes by order of score

func ValidateVictims added in v0.4.0

func ValidateVictims(preemptor *api.TaskInfo, node *api.NodeInfo, victims []*api.TaskInfo) error

ValidateVictims returns an error if the resources of the victims can't satisfy the preemptor

Types

type FakeBinder

type FakeBinder struct {
	sync.Mutex
	Binds   map[string]string
	Channel chan string
}

FakeBinder is used as fake binder

func (*FakeBinder) Bind

func (fb *FakeBinder) Bind(p *v1.Pod, hostname string) error

Bind used by fake binder struct to bind pods

type FakeEvictor

type FakeEvictor struct {
	sync.Mutex

	Channel chan string
	// contains filtered or unexported fields
}

FakeEvictor is used as fake evictor

func (*FakeEvictor) Evict

func (fe *FakeEvictor) Evict(p *v1.Pod, reason string) error

Evict is used by fake evictor to evict pods

func (*FakeEvictor) Evicts

func (fe *FakeEvictor) Evicts() []string

Evicts returns copy of evicted pods.

type FakeStatusUpdater

type FakeStatusUpdater struct {
}

FakeStatusUpdater is used for fake status update

func (*FakeStatusUpdater) UpdatePodCondition

func (ftsu *FakeStatusUpdater) UpdatePodCondition(pod *v1.Pod, podCondition *v1.PodCondition) (*v1.Pod, error)

UpdatePodCondition is a empty function

func (*FakeStatusUpdater) UpdatePodGroup

func (ftsu *FakeStatusUpdater) UpdatePodGroup(pg *api.PodGroup) (*api.PodGroup, error)

UpdatePodGroup is a empty function

type FakeVolumeBinder

type FakeVolumeBinder struct {
}

FakeVolumeBinder is used as fake volume binder

func (*FakeVolumeBinder) AllocateVolumes

func (fvb *FakeVolumeBinder) AllocateVolumes(task *api.TaskInfo, hostname string, podVolumes *volumescheduling.PodVolumes) error

AllocateVolumes is a empty function

func (*FakeVolumeBinder) BindVolumes

func (fvb *FakeVolumeBinder) BindVolumes(task *api.TaskInfo, podVolumes *volumescheduling.PodVolumes) error

BindVolumes is a empty function

func (*FakeVolumeBinder) GetPodVolumes added in v1.3.0

func (fvb *FakeVolumeBinder) GetPodVolumes(task *api.TaskInfo, node *v1.Node) (*volumescheduling.PodVolumes, error)

GetPodVolumes is a empty function

type PriorityQueue

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

PriorityQueue implements a scheduling queue.

func NewPriorityQueue

func NewPriorityQueue(lessFn api.LessFn) *PriorityQueue

NewPriorityQueue returns a PriorityQueue

func (*PriorityQueue) Empty

func (q *PriorityQueue) Empty() bool

Empty check if queue is empty

func (*PriorityQueue) Len

func (q *PriorityQueue) Len() int

Len returns Len of the priority queue

func (*PriorityQueue) Pop

func (q *PriorityQueue) Pop() interface{}

Pop pops element in the priority Queue

func (*PriorityQueue) Push

func (q *PriorityQueue) Push(it interface{})

Push pushes element in the priority Queue

type ResourceReservation added in v1.1.0

type ResourceReservation struct {
	TargetJob   *api.JobInfo
	LockedNodes map[string]*api.NodeInfo
}

ResourceReservation is struct used for resource reservation

var Reservation *ResourceReservation

Reservation is used to record target job and locked nodes

func NewResourceReservation added in v1.1.0

func NewResourceReservation() *ResourceReservation

NewResourceReservation is used to create global instance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL