Documentation

Overview

    Copyright 2017 The Kubernetes Authors.

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0
    

    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

    Index

    Constants

    Variables

    This section is empty.

    Functions

    func AllocatedStatus

    func AllocatedStatus(status TaskStatus) bool

    func JobTerminated

    func JobTerminated(job *JobInfo) bool

      JobTerminated checkes whether job was terminated.

      func MergeErrors

      func MergeErrors(errs ...error) error

      func ResourceNames

      func ResourceNames() []v1.ResourceName

      Types

      type ClusterInfo

      type ClusterInfo struct {
      	Jobs []*JobInfo
      
      	Nodes []*NodeInfo
      }

        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 JobID

          type JobID types.UID

            JobID is the type of JobInfo's ID.

            type JobInfo

            type JobInfo struct {
            	UID JobID
            
            	Name      string
            	Namespace string
            
            	Priority int
            
            	NodeSelector map[string]string
            	MinAvailable int
            
            	// All tasks of the Job.
            	TaskStatusIndex map[TaskStatus]tasksMap
            	Tasks           tasksMap
            
            	Allocated    *Resource
            	TotalRequest *Resource
            
            	// Candidate hosts for this job.
            	Candidates []*NodeInfo
            
            	SchedSpec *arbv1.SchedulingSpec
            
            	// TODO(k82cn): keep backward compatbility, removed it when v1alpha1 finalized.
            	PDB *policyv1.PodDisruptionBudget
            }

            func NewJobInfo

            func NewJobInfo(uid JobID) *JobInfo

            func (*JobInfo) AddTaskInfo

            func (ps *JobInfo) AddTaskInfo(pi *TaskInfo)

            func (*JobInfo) Clone

            func (ps *JobInfo) Clone() *JobInfo

            func (*JobInfo) DeleteTaskInfo

            func (ps *JobInfo) DeleteTaskInfo(pi *TaskInfo) error

            func (*JobInfo) GetTasks

            func (ps *JobInfo) GetTasks(statuses ...TaskStatus) []*TaskInfo

            func (*JobInfo) SetPDB

            func (ps *JobInfo) SetPDB(pbd *policyv1.PodDisruptionBudget)

            func (*JobInfo) SetSchedulingSpec

            func (ps *JobInfo) SetSchedulingSpec(spec *arbv1.SchedulingSpec)

            func (JobInfo) String

            func (ps JobInfo) String() string

            func (*JobInfo) UnsetPDB

            func (ps *JobInfo) UnsetPDB()

            func (*JobInfo) UnsetSchedulingSpec

            func (ps *JobInfo) UnsetSchedulingSpec()

            func (*JobInfo) UpdateTaskStatus

            func (ps *JobInfo) UpdateTaskStatus(task *TaskInfo, status TaskStatus) error

            type LessFn

            type LessFn func(interface{}, interface{}) bool

              LessFn is the func declaration used by sort or priority queue.

              type NodeInfo

              type NodeInfo struct {
              	Name string
              	Node *v1.Node
              
              	// The releasing resource on that node
              	Releasing *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
              }

                NodeInfo is node level aggregated information.

                func NewNodeInfo

                func NewNodeInfo(node *v1.Node) *NodeInfo

                func (*NodeInfo) AddTask

                func (ni *NodeInfo) AddTask(task *TaskInfo) error

                func (*NodeInfo) Clone

                func (ni *NodeInfo) Clone() *NodeInfo

                func (*NodeInfo) PipelineTask

                func (ni *NodeInfo) PipelineTask(task *TaskInfo) error

                func (*NodeInfo) RemoveTask

                func (ni *NodeInfo) RemoveTask(ti *TaskInfo) error

                func (*NodeInfo) SetNode

                func (ni *NodeInfo) SetNode(node *v1.Node)

                func (NodeInfo) String

                func (ni NodeInfo) String() string

                func (*NodeInfo) UpdateTask

                func (ni *NodeInfo) UpdateTask(ti *TaskInfo) error

                type Resource

                type Resource struct {
                	MilliCPU float64
                	Memory   float64
                	GPU      int64
                }

                func EmptyResource

                func EmptyResource() *Resource

                func NewResource

                func NewResource(rl v1.ResourceList) *Resource

                func (*Resource) Add

                func (r *Resource) Add(rr *Resource) *Resource

                func (*Resource) Clone

                func (r *Resource) Clone() *Resource

                func (*Resource) Get

                func (r *Resource) Get(rn v1.ResourceName) float64

                func (*Resource) IsEmpty

                func (r *Resource) IsEmpty() bool

                func (*Resource) IsZero

                func (r *Resource) IsZero(rn v1.ResourceName) bool

                func (*Resource) Less

                func (r *Resource) Less(rr *Resource) bool

                func (*Resource) LessEqual

                func (r *Resource) LessEqual(rr *Resource) bool

                func (*Resource) NonNegSub

                func (r *Resource) NonNegSub(rr *Resource) *Resource

                  Sub subtracts two Resource objects and return zero for negative subtractions.

                  func (*Resource) Replace

                  func (r *Resource) Replace(rr *Resource) *Resource

                  func (*Resource) String

                  func (r *Resource) String() string

                  func (*Resource) Sub

                  func (r *Resource) Sub(rr *Resource) *Resource

                    Sub subtracts two Resource objects.

                    type TaskID

                    type TaskID types.UID

                    func PodKey

                    func PodKey(pod *v1.Pod) TaskID

                      PodKey returns the string key of a pod.

                      type TaskInfo

                      type TaskInfo struct {
                      	UID TaskID
                      	Job JobID
                      
                      	Name      string
                      	Namespace string
                      
                      	Resreq *Resource
                      
                      	NodeName string
                      	Status   TaskStatus
                      	Priority int32
                      
                      	Pod *v1.Pod
                      }

                      func NewTaskInfo

                      func NewTaskInfo(pod *v1.Pod) *TaskInfo

                      func (*TaskInfo) Clone

                      func (pi *TaskInfo) Clone() *TaskInfo

                      func (TaskInfo) String

                      func (pi TaskInfo) String() string

                      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 ValidateFn

                        type ValidateFn func(interface{}) bool

                          ValidateFn is the func declaration used to check object's status.