nodedb

package
v0.3.70-rc-14aa097 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindPodToNode

BindPodToNode returns a copy of node with req bound to it.

func EvictPodFromNode

EvictPodFromNode returns a copy of node with req evicted from it. Specifically: - The job is marked as evicted on the node. - AllocatedByJobId and AllocatedByQueue are not updated. - Resources requested by the evicted pod are marked as allocated at priority evictedPriority.

func JobIdFromPodRequirements

func JobIdFromPodRequirements(req *schedulerobjects.PodRequirements) (string, error)

func NodeJobDiff

func NodeJobDiff(txnA, txnB *memdb.Txn) (map[string]*schedulerobjects.Node, map[string]*schedulerobjects.Node, error)

NodeJobDiff compares two snapshots of the NodeDb memdb and returns - a map from job ids of all preempted jobs to the node they used to be on - a map from job ids of all scheduled jobs to the node they were scheduled on that happened between the two snapshots.

func QueueFromPodRequirements

func QueueFromPodRequirements(req *schedulerobjects.PodRequirements) (string, error)

func UnbindPodFromNode

UnbindPodFromNode returns a copy of node with req unbound from it.

func UnbindPodsFromNode

func UnbindPodsFromNode(reqs []*schedulerobjects.PodRequirements, node *schedulerobjects.Node) (*schedulerobjects.Node, error)

UnbindPodsFromNode returns a node with all reqs unbound from it.

func UnschedulableTaint added in v0.3.65

func UnschedulableTaint() v1.Taint

UnschedulableTaint returns the taint automatically added to unschedulable nodes on inserting into the nodeDb.

func UnschedulableToleration added in v0.3.65

func UnschedulableToleration() v1.Toleration

UnschedulableToleration returns a toleration that tolerates UnschedulableTaint().

Types

type NodeAvailableResourceIndex

type NodeAvailableResourceIndex struct {
	// Resource name, e.g., "cpu", "gpu", or "memory".
	Resource string
	// Job priority.
	Priority int32
}

func (*NodeAvailableResourceIndex) FromArgs

func (index *NodeAvailableResourceIndex) FromArgs(args ...interface{}) ([]byte, error)

FromArgs computes the index key from a set of arguments. Takes a single argument resourceAmount of type resource.Quantity.

func (*NodeAvailableResourceIndex) FromObject

func (index *NodeAvailableResourceIndex) FromObject(raw interface{}) (bool, []byte, error)

FromObject extracts the index key from a *schedulerobjects.Node.

type NodeDb

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

NodeDb is the scheduler-internal system for storing node information. It's used to efficiently find nodes on which a pod can be scheduled.

func NewNodeDb

func NewNodeDb(
	priorityClasses map[string]configuration.PriorityClass,
	maxExtraNodesToConsider uint,
	indexedResources,
	indexedTaints,
	indexedNodeLabels []string,
) (*NodeDb, error)

func (*NodeDb) ClearAllocated

func (nodeDb *NodeDb) ClearAllocated() error

ClearAllocated zeroes out allocated resources on all nodes in the NodeDb.

func (*NodeDb) GetNode

func (nodeDb *NodeDb) GetNode(id string) (*schedulerobjects.Node, error)

GetNode returns a node in the db with given id.

func (*NodeDb) GetNodeWithTxn

func (nodeDb *NodeDb) GetNodeWithTxn(txn *memdb.Txn, id string) (*schedulerobjects.Node, error)

GetNodeWithTxn returns a node in the db with given id, within the provided transactions.

func (*NodeDb) NodeTypesMatchingPod

func (nodeDb *NodeDb) NodeTypesMatchingPod(req *schedulerobjects.PodRequirements) ([]*schedulerobjects.NodeType, map[string]int, error)

NodeTypesMatchingPod returns a slice with all node types a pod could be scheduled on. It also returns the number of nodes excluded by reason for exclusion.

func (*NodeDb) NumNodes

func (nodeDb *NodeDb) NumNodes() int

func (*NodeDb) ScheduleMany

ScheduleMany assigns a set of pods to nodes. The assignment is atomic, i.e., either all pods are successfully assigned to nodes or none are. The returned bool indicates whether assignment succeeded or not. TODO: Pass through contexts to support timeouts.

func (*NodeDb) ScheduleManyWithTxn

func (nodeDb *NodeDb) ScheduleManyWithTxn(txn *memdb.Txn, reqs []*schedulerobjects.PodRequirements) ([]*schedulercontext.PodSchedulingContext, bool, error)

func (*NodeDb) SelectAndBindNodeToPod

func (nodeDb *NodeDb) SelectAndBindNodeToPod(req *schedulerobjects.PodRequirements) (*schedulercontext.PodSchedulingContext, error)

func (*NodeDb) SelectAndBindNodeToPodWithTxn

func (nodeDb *NodeDb) SelectAndBindNodeToPodWithTxn(txn *memdb.Txn, req *schedulerobjects.PodRequirements) (*schedulercontext.PodSchedulingContext, error)

func (*NodeDb) SelectNodeForPod

func (*NodeDb) SelectNodeForPodWithTxn

func (nodeDb *NodeDb) SelectNodeForPodWithTxn(txn *memdb.Txn, req *schedulerobjects.PodRequirements) (*schedulercontext.PodSchedulingContext, error)

SelectNodeForPodWithTxn selects a node on which the pod can be scheduled.

func (*NodeDb) String

func (nodeDb *NodeDb) String() string

func (*NodeDb) TotalResources

func (nodeDb *NodeDb) TotalResources() schedulerobjects.ResourceList

func (*NodeDb) Txn

func (nodeDb *NodeDb) Txn(write bool) *memdb.Txn

func (*NodeDb) Upsert

func (nodeDb *NodeDb) Upsert(node *schedulerobjects.Node) error

func (*NodeDb) UpsertMany

func (nodeDb *NodeDb) UpsertMany(nodes []*schedulerobjects.Node) error

func (*NodeDb) UpsertManyWithTxn

func (nodeDb *NodeDb) UpsertManyWithTxn(txn *memdb.Txn, nodes []*schedulerobjects.Node) error

func (*NodeDb) UpsertWithTxn

func (nodeDb *NodeDb) UpsertWithTxn(txn *memdb.Txn, node *schedulerobjects.Node) error

type NodeIterator

type NodeIterator interface {
	NextNode() *schedulerobjects.Node
}

type NodePairIterator

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

func NewNodePairIterator

func NewNodePairIterator(txnA, txnB *memdb.Txn) (*NodePairIterator, error)

func (*NodePairIterator) Next

func (it *NodePairIterator) Next() interface{}

func (*NodePairIterator) NextItem

func (it *NodePairIterator) NextItem() (rv *NodePairIteratorItem)

func (*NodePairIterator) WatchCh

func (it *NodePairIterator) WatchCh() <-chan struct{}

type NodePairIteratorItem

type NodePairIteratorItem struct {
	NodeA *schedulerobjects.Node
	NodeB *schedulerobjects.Node
}

type NodeTypeIterator

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

NodeTypeIterator is an iterator over all nodes of a given nodeType with at least some specified amount of resources allocatable at a given priority. For example, all nodes of nodeType "foo" with at least 2 cores and 1Gi memory allocatable at priority 2. Nodes are returned in sorted order, from least to most of the specified resource available.

func NewNodeTypeIterator

func NewNodeTypeIterator(txn *memdb.Txn, nodeTypeId string, priority int32, indexedResources []string, indexedResourceRequests []resource.Quantity) (*NodeTypeIterator, error)

func (*NodeTypeIterator) Next

func (it *NodeTypeIterator) Next() interface{}

func (*NodeTypeIterator) NextNode

func (it *NodeTypeIterator) NextNode() (*schedulerobjects.Node, error)

func (*NodeTypeIterator) WatchCh

func (it *NodeTypeIterator) WatchCh() <-chan struct{}

type NodeTypesIterator

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

NodeTypesIterator is an iterator over all nodes of the given nodeTypes with at least some specified amount of resources allocatable at a given priority. For example, all nodes of nodeType "foo" and "bar" with at least 2 cores and 1Gi memory allocatable at priority 2. Nodes are returned in sorted order, from least to most of the specified resource available.

func NewNodeTypesIterator

func NewNodeTypesIterator(txn *memdb.Txn, nodeTypeIds []string, priority int32, indexedResources []string, indexedResourceRequests []resource.Quantity) (*NodeTypesIterator, error)

func (*NodeTypesIterator) Next

func (it *NodeTypesIterator) Next() interface{}

func (*NodeTypesIterator) NextNode

func (it *NodeTypesIterator) NextNode() (*schedulerobjects.Node, error)

func (*NodeTypesIterator) WatchCh

func (it *NodeTypesIterator) WatchCh() <-chan struct{}

type NodesIterator

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

NodesIterator is an iterator over all nodes in the db.

func NewNodesIterator

func NewNodesIterator(txn *memdb.Txn) (*NodesIterator, error)

func (*NodesIterator) Next

func (it *NodesIterator) Next() interface{}

func (*NodesIterator) NextNode

func (it *NodesIterator) NextNode() *schedulerobjects.Node

func (*NodesIterator) WatchCh

func (it *NodesIterator) WatchCh() <-chan struct{}

Jump to

Keyboard shortcuts

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