Documentation
¶
Index ¶
- Constants
- func AllocatedStatus(status TaskStatus) bool
- func JobTerminated(job *JobInfo) bool
- func MergeErrors(errs ...error) error
- type BatchNodeOrderFn
- type ClusterInfo
- type CompareFn
- type EvictableFn
- type FitError
- type FitErrors
- type JobID
- type JobInfo
- func (ji *JobInfo) AddTaskInfo(ti *TaskInfo)
- func (ji *JobInfo) Clone() *JobInfo
- func (ji *JobInfo) DeleteTaskInfo(ti *TaskInfo) error
- func (ji *JobInfo) FitError() string
- func (ji *JobInfo) Pipelined() bool
- func (ji *JobInfo) Ready() bool
- func (ji *JobInfo) ReadyTaskNum() int32
- func (ji *JobInfo) SetPodGroup(pg *PodGroup)
- func (ji JobInfo) String() string
- func (ji *JobInfo) UnsetPodGroup()
- func (ji *JobInfo) UpdateTaskStatus(task *TaskInfo, status TaskStatus) error
- func (ji *JobInfo) ValidTaskNum() int32
- func (ji *JobInfo) WaitingTaskNum() int32
- type LessFn
- type NamespaceCollection
- type NamespaceInfo
- type NamespaceName
- type NodeInfo
- func (ni *NodeInfo) AddTask(task *TaskInfo) error
- func (ni *NodeInfo) Clone() *NodeInfo
- func (ni *NodeInfo) FutureIdle() *Resource
- func (ni *NodeInfo) Pods() (pods []*v1.Pod)
- func (ni *NodeInfo) Ready() bool
- func (ni *NodeInfo) RemoveTask(ti *TaskInfo) error
- func (ni *NodeInfo) SetNode(node *v1.Node)
- func (ni NodeInfo) String() string
- func (ni *NodeInfo) UpdateTask(ti *TaskInfo) error
- type NodeMapFn
- type NodeOrderFn
- type NodeOrderMapFn
- type NodeOrderReduceFn
- type NodePhase
- type NodeReduceFn
- type NodeResourceMap
- type NodeState
- type PodGroup
- type PodGroupPhase
- type PredicateFn
- type QueueID
- type QueueInfo
- type Resource
- func (r *Resource) Add(rr *Resource) *Resource
- func (r *Resource) AddScalar(name v1.ResourceName, quantity float64)
- func (r *Resource) Clone() *Resource
- func (r *Resource) Diff(rr *Resource) (*Resource, *Resource)
- func (r *Resource) FitDelta(rr *Resource) *Resource
- func (r *Resource) Get(rn v1.ResourceName) float64
- func (r *Resource) IsEmpty() bool
- func (r *Resource) IsZero(rn v1.ResourceName) bool
- func (r *Resource) Less(rr *Resource) bool
- func (r *Resource) LessEqual(rr *Resource) bool
- func (r *Resource) LessEqualStrict(rr *Resource) bool
- func (r *Resource) Multi(ratio float64) *Resource
- func (r *Resource) ResourceNames() []v1.ResourceName
- func (r *Resource) SetMaxResource(rr *Resource)
- func (r *Resource) SetScalar(name v1.ResourceName, quantity float64)
- func (r *Resource) String() string
- func (r *Resource) Sub(rr *Resource) *Resource
- type TaskID
- type TaskInfo
- type TaskStatus
- type ValidateExFn
- type ValidateFn
- type ValidateResult
Constants ¶
const ( // NamespaceWeightKey is the key in ResourceQuota.spec.hard indicating the weight of this namespace NamespaceWeightKey = "volcano.sh/namespace.weight" // DefaultNamespaceWeight is the default weight of namespace DefaultNamespaceWeight = 1 )
const ( //PodGroupVersionV1Alpha1 represents PodGroupVersion of V1Alpha1 PodGroupVersionV1Alpha1 string = "v1alpha1" //PodGroupVersionV1Alpha2 represents PodGroupVersion of V1Alpha2 PodGroupVersionV1Alpha2 string = "v1alpha2" )
These are the valid phase of podGroups.
const ( // NodePodNumberExceeded means pods in node exceed the allocatable pod number NodePodNumberExceeded = "node(s) pod number exceeded" // NodeResourceFitFailed means node could not fit the request of pod NodeResourceFitFailed = "node(s) resource fit failed" AllNodeUnavailableMsg = "all nodes are unavailable" )
const (
// GPUResourceName need to follow https://github.com/NVIDIA/k8s-device-plugin/blob/66a35b71ac4b5cbfb04714678b548bd77e5ba719/server.go#L20
GPUResourceName = "nvidia.com/gpu"
)
Variables ¶
This section is empty.
Functions ¶
func AllocatedStatus ¶
func AllocatedStatus(status TaskStatus) bool
AllocatedStatus checks whether the tasks has AllocatedStatus
func JobTerminated ¶
JobTerminated checks whether job was terminated.
func MergeErrors ¶
MergeErrors is used to merge multiple errors into single error
Types ¶
type BatchNodeOrderFn ¶
BatchNodeOrderFn is the func declaration used to get priority score for ALL nodes for a particular task.
type ClusterInfo ¶
type ClusterInfo struct {
Jobs map[JobID]*JobInfo
Nodes map[string]*NodeInfo
Queues map[QueueID]*QueueInfo
NamespaceInfo map[NamespaceName]*NamespaceInfo
}
ClusterInfo is a snapshot of cluster by cache.
func (ClusterInfo) String ¶
func (ci ClusterInfo) String() string
type CompareFn ¶
type CompareFn func(interface{}, interface{}) int
CompareFn is the func declaration used by sort or priority queue.
type EvictableFn ¶
EvictableFn is the func declaration used to evict tasks.
type FitError ¶
FitError describe the reason why task could not fit that node
func NewFitError ¶
NewFitError return FitError by message
func NewFitErrorByReasons ¶
func NewFitErrorByReasons(task *TaskInfo, node *NodeInfo, reasons ...algorithm.PredicateFailureReason) *FitError
NewFitErrorByReasons return FitError by reasons
type FitErrors ¶
type FitErrors struct {
// contains filtered or unexported fields
}
FitErrors is set of FitError on many nodes
func (*FitErrors) SetNodeError ¶
SetNodeError set the node error in FitErrors
type JobInfo ¶
type JobInfo struct {
UID JobID
Name string
Namespace string
Queue QueueID
Priority int32
MinAvailable int32
NodesFitDelta NodeResourceMap
JobFitErrors string
NodesFitErrors map[TaskID]*FitErrors
// All tasks of the Job.
TaskStatusIndex map[TaskStatus]tasksMap
Tasks tasksMap
Allocated *Resource
TotalRequest *Resource
CreationTimestamp metav1.Time
PodGroup *PodGroup
}
JobInfo will have all info of a Job
func NewJobInfo ¶
NewJobInfo creates a new jobInfo for set of tasks
func (*JobInfo) AddTaskInfo ¶
AddTaskInfo is used to add a task to a job
func (*JobInfo) DeleteTaskInfo ¶
DeleteTaskInfo is used to delete a task from a job
func (*JobInfo) FitError ¶
FitError returns detailed information on why a job's task failed to fit on each available node
func (*JobInfo) Pipelined ¶
Pipelined returns whether the number of ready and pipelined task is enough
func (*JobInfo) ReadyTaskNum ¶
ReadyTaskNum returns the number of tasks that are ready or that is best-effort.
func (*JobInfo) SetPodGroup ¶
SetPodGroup sets podGroup details to a job
func (*JobInfo) UnsetPodGroup ¶
func (ji *JobInfo) UnsetPodGroup()
UnsetPodGroup removes podGroup details from a job
func (*JobInfo) UpdateTaskStatus ¶
func (ji *JobInfo) UpdateTaskStatus(task *TaskInfo, status TaskStatus) error
UpdateTaskStatus is used to update task's status in a job
func (*JobInfo) ValidTaskNum ¶
ValidTaskNum returns the number of tasks that are valid.
func (*JobInfo) WaitingTaskNum ¶
WaitingTaskNum returns the number of tasks that are pipelined.
type LessFn ¶
type LessFn func(interface{}, interface{}) bool
LessFn is the func declaration used by sort or priority queue.
type NamespaceCollection ¶
type NamespaceCollection struct {
Name string
// contains filtered or unexported fields
}
NamespaceCollection will record all details about namespace
func NewNamespaceCollection ¶
func NewNamespaceCollection(name string) *NamespaceCollection
NewNamespaceCollection creates new NamespaceCollection object to record all information about a namespace
func (*NamespaceCollection) Delete ¶
func (n *NamespaceCollection) Delete(quota *v1.ResourceQuota)
Delete remove the registered information according quota object
func (*NamespaceCollection) Snapshot ¶
func (n *NamespaceCollection) Snapshot() *NamespaceInfo
Snapshot will clone a NamespaceInfo without Heap according NamespaceCollection
func (*NamespaceCollection) Update ¶
func (n *NamespaceCollection) Update(quota *v1.ResourceQuota)
Update modify the registered information according quota object
type NamespaceInfo ¶
type NamespaceInfo struct {
// Name is the name of this namespace
Name NamespaceName
// Weight is the highest weight among many ResourceQuota.
Weight int64
}
NamespaceInfo records information of namespace
func (*NamespaceInfo) GetWeight ¶
func (n *NamespaceInfo) GetWeight() int64
GetWeight returns weight of a namespace, any invalid case would get default value
type NodeInfo ¶
type NodeInfo struct {
Name string
Node *v1.Node
// The state of node
State NodeState
// The releasing resource on that node
Releasing *Resource
// The pipelined resource on that node
Pipelined *Resource
// The idle resource on that node
Idle *Resource
// The used resource on that node, including running and terminating
// pods
Used *Resource
Allocatable *Resource
Capability *Resource
Tasks map[TaskID]*TaskInfo
// Used to store custom information
Others map[string]interface{}
}
NodeInfo is node level aggregated information.
func NewNodeInfo ¶
NewNodeInfo is used to create new nodeInfo object
func (*NodeInfo) FutureIdle ¶
FutureIdle returns resources that will be idle in the future:
That is current idle resources plus released resources minus pipelined resources.
func (*NodeInfo) RemoveTask ¶
RemoveTask used to remove a task from nodeInfo object
func (*NodeInfo) UpdateTask ¶
UpdateTask is used to update a task in nodeInfo object
type NodeMapFn ¶
NodeMapFn is the func declaration used to get priority score for a node for a particular task.
type NodeOrderFn ¶
NodeOrderFn is the func declaration used to get priority score for a node for a particular task.
type NodeOrderMapFn ¶
NodeOrderMapFn is the func declaration used to get priority score of all plugins for a node for a particular task.
type NodeOrderReduceFn ¶
type NodeOrderReduceFn func(*TaskInfo, map[string]schedulerapi.HostPriorityList) (map[string]float64, error)
NodeOrderReduceFn is the func declaration used to reduce priority score of all nodes for a plugiin for a particular task.
type NodeReduceFn ¶
type NodeReduceFn func(*TaskInfo, schedulerapi.HostPriorityList) error
NodeReduceFn is the func declaration used to reduce priority score for a node for a particular task.
type NodeResourceMap ¶
NodeResourceMap stores resource in a node
type PodGroup ¶
type PodGroup struct {
scheduling.PodGroup
//Version represents the version of PodGroup
Version string
}
PodGroup is a collection of Pod; used for batch workload.
type PodGroupPhase ¶
type PodGroupPhase string
PodGroupPhase is the phase of a pod group at the current time.
type PredicateFn ¶
PredicateFn is the func declaration used to predicate node for task.
type QueueInfo ¶
type QueueInfo struct {
UID QueueID
Name string
Weight int32
Queue *scheduling.Queue
}
QueueInfo will have all details about queue
func NewQueueInfo ¶
func NewQueueInfo(queue *scheduling.Queue) *QueueInfo
NewQueueInfo creates new queueInfo object
func (*QueueInfo) Reclaimable ¶
Reclaimable return whether queue is reclaimable
type Resource ¶
type Resource struct {
MilliCPU float64
Memory float64
// ScalarResources
ScalarResources map[v1.ResourceName]float64
// MaxTaskNum is only used by predicates; it should NOT
// be accounted in other operators, e.g. Add.
MaxTaskNum int
}
Resource struct defines all the resource type
func EmptyResource ¶
func EmptyResource() *Resource
EmptyResource creates a empty resource object and returns
func GetPodResourceRequest ¶
GetPodResourceRequest returns all the resource required for that pod
func GetPodResourceWithoutInitContainers ¶
GetPodResourceWithoutInitContainers returns Pod's resource request, it does not contain init containers' resource request.
func NewResource ¶
func NewResource(rl v1.ResourceList) *Resource
NewResource create a new resource object from resource list
func (*Resource) AddScalar ¶
func (r *Resource) AddScalar(name v1.ResourceName, quantity float64)
AddScalar adds a resource by a scalar value of this resource.
func (*Resource) FitDelta ¶
FitDelta Computes the delta between a resource oject representing available resources an operand representing resources being requested. Any field that is less than 0 after the operation represents an insufficient resource.
func (*Resource) Get ¶
func (r *Resource) Get(rn v1.ResourceName) float64
Get returns the resource value for that particular resource type
func (*Resource) IsEmpty ¶
IsEmpty returns bool after checking any of resource is less than min possible value
func (*Resource) IsZero ¶
func (r *Resource) IsZero(rn v1.ResourceName) bool
IsZero checks whether that resource is less than min possible value
func (*Resource) LessEqualStrict ¶
LessEqualStrict checks whether a resource is less or equal than other
func (*Resource) ResourceNames ¶
func (r *Resource) ResourceNames() []v1.ResourceName
ResourceNames returns all resource types
func (*Resource) SetMaxResource ¶
SetMaxResource compares with ResourceList and takes max value for each Resource.
func (*Resource) SetScalar ¶
func (r *Resource) SetScalar(name v1.ResourceName, quantity float64)
SetScalar sets a resource by a scalar value of this resource.
type TaskInfo ¶
type TaskInfo struct {
UID TaskID
Job JobID
Name string
Namespace string
// Resreq is the resource that used when task running.
Resreq *Resource
// InitResreq is the resource that used to launch a task.
InitResreq *Resource
NodeName string
Status TaskStatus
Priority int32
VolumeReady bool
Pod *v1.Pod
}
TaskInfo will have all infos about the task
func NewTaskInfo ¶
func NewTaskInfo(pod *v1.Pod) *TaskInfo
NewTaskInfo creates new taskInfo object for a Pod
type TaskStatus ¶
type TaskStatus int
TaskStatus defines the status of a task/pod.
const ( // Pending means the task is pending in the apiserver. Pending TaskStatus = 1 << iota // Allocated means the scheduler assigns a host to it. Allocated // Pipelined means the scheduler assigns a host to wait for releasing resource. Pipelined // Binding means the scheduler send Bind request to apiserver. Binding // Bound means the task/Pod bounds to a host. Bound // Running means a task is running on the host. Running // Releasing means a task/pod is deleted. Releasing // Succeeded means that all containers in the pod have voluntarily terminated // with a container exit code of 0, and the system is not going to restart any of these containers. Succeeded // Failed means that all containers in the pod have terminated, and at least one container has // terminated in a failure (exited with a non-zero exit code or was stopped by the system). Failed // Unknown means the status of task/pod is unknown to the scheduler. Unknown )
func (TaskStatus) String ¶
func (ts TaskStatus) String() string
type ValidateExFn ¶
type ValidateExFn func(interface{}) *ValidateResult
ValidateExFn is the func declaration used to validate the result
type ValidateFn ¶
type ValidateFn func(interface{}) bool
ValidateFn is the func declaration used to check object's status.
type ValidateResult ¶
ValidateResult is struct to which can used to determine the result