api

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

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

	Queues []*QueueInfo

	Others []*TaskInfo
}

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

	Queue QueueID

	Priority int

	NodeSelector map[string]string
	MinAvailable int32

	// All tasks of the Job.
	TaskStatusIndex map[TaskStatus]tasksMap
	Tasks           tasksMap

	Allocated    *Resource
	TotalRequest *Resource

	PodGroup *arbcorev1.PodGroup

	// TODO(k82cn): keep backward compatbility, removed it when v1alpha1 finalized.
	PDB *policyv1.PodDisruptionBudget
}

func NewJobInfo

func NewJobInfo(uid JobID) *JobInfo

func (*JobInfo) AddTaskInfo

func (ji *JobInfo) AddTaskInfo(ti *TaskInfo)

func (*JobInfo) Clone

func (ji *JobInfo) Clone() *JobInfo

func (*JobInfo) DeleteTaskInfo

func (ji *JobInfo) DeleteTaskInfo(ti *TaskInfo) error

func (*JobInfo) GetTasks

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

func (*JobInfo) SetPDB

func (ji *JobInfo) SetPDB(pdb *policyv1.PodDisruptionBudget)

func (*JobInfo) SetPodGroup

func (ji *JobInfo) SetPodGroup(pg *arbcorev1.PodGroup)

func (JobInfo) String

func (ji JobInfo) String() string

func (*JobInfo) UnsetPDB

func (ji *JobInfo) UnsetPDB()

func (*JobInfo) UnsetPodGroup

func (ji *JobInfo) UnsetPodGroup()

func (*JobInfo) UpdateTaskStatus

func (ji *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) Pods

func (ni *NodeInfo) Pods() (pods []*v1.Pod)

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 PredicateFn

type PredicateFn func(*TaskInfo, *NodeInfo) error

PredicateFn is the func declaration used to predicate node for task.

type PreemptableFn

type PreemptableFn func(*TaskInfo, []*TaskInfo) []*TaskInfo

PreemptableFn is the func declaration used to reclaim tasks.

type QueueID

type QueueID types.UID

type QueueInfo

type QueueInfo struct {
	UID  QueueID
	Name string

	Weight int32

	Queue *arbcorev1.Queue
}

func NewQueueInfo

func NewQueueInfo(queue *arbcorev1.Queue) *QueueInfo

func (*QueueInfo) Clone

func (q *QueueInfo) Clone() *QueueInfo

type ReclaimableFn

type ReclaimableFn func(*TaskInfo, []*TaskInfo) []*TaskInfo

ReclaimableFn is the func declaration used to reclaim tasks.

type Resource

type Resource struct {
	MilliCPU float64
	Memory   float64
	MilliGPU float64
}

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) Multi

func (r *Resource) Multi(ratio float64) *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 (ti *TaskInfo) Clone() *TaskInfo

func (TaskInfo) String

func (ti 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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