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
- func AllocatedStatus(status TaskStatus) bool
- func JobTerminated(job *JobInfo) bool
- func MergeErrors(errs ...error) error
- func ResourceNames() []v1.ResourceName
- type ClusterInfo
- type CompareFn
- type JobID
- type JobInfo
- func (ps *JobInfo) AddTaskInfo(pi *TaskInfo)
- func (ps *JobInfo) Clone() *JobInfo
- func (ps *JobInfo) DeleteTaskInfo(pi *TaskInfo) error
- func (ps *JobInfo) GetTasks(statuses ...TaskStatus) []*TaskInfo
- func (ps *JobInfo) SetPDB(pbd *policyv1.PodDisruptionBudget)
- func (ps *JobInfo) SetSchedulingSpec(spec *arbv1.SchedulingSpec)
- func (ps JobInfo) String() string
- func (ps *JobInfo) UnsetPDB()
- func (ps *JobInfo) UnsetSchedulingSpec()
- func (ps *JobInfo) UpdateTaskStatus(task *TaskInfo, status TaskStatus) error
- type LessFn
- type NodeInfo
- func (ni *NodeInfo) AddTask(task *TaskInfo) error
- func (ni *NodeInfo) Clone() *NodeInfo
- func (ni *NodeInfo) PipelineTask(task *TaskInfo) error
- 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 Resource
- func (r *Resource) Add(rr *Resource) *Resource
- func (r *Resource) Clone() *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) String() string
- func (r *Resource) Sub(rr *Resource) *Resource
- type TaskID
- type TaskInfo
- type TaskStatus
- type ValidateFn
Constants ¶
const (
// 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
func JobTerminated ¶
JobTerminated checkes whether job was terminated.
func MergeErrors ¶
func ResourceNames ¶
func ResourceNames() []v1.ResourceName
Types ¶
type ClusterInfo ¶
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 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 (*JobInfo) AddTaskInfo ¶
func (*JobInfo) DeleteTaskInfo ¶
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) 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 (*NodeInfo) PipelineTask ¶
func (*NodeInfo) RemoveTask ¶
func (*NodeInfo) UpdateTask ¶
type Resource ¶
func EmptyResource ¶
func EmptyResource() *Resource
func NewResource ¶
func NewResource(rl v1.ResourceList) *Resource
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 ¶
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.