podtaskexecutor

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LabelKeyJobUID label is added on Pods to identify the parent Job by UID.
	LabelKeyJobUID = executiongroup.AddGroupToLabel("job-uid")

	// LabelKeyTaskRetryIndex label is added on Pods to indicate the retry index of
	// the task.
	LabelKeyTaskRetryIndex = executiongroup.AddGroupToLabel("task-retry-index")

	// LabelKeyTaskParallelIndexHash label is added on Pods to indicate the parallel
	// index hash of the task.
	LabelKeyTaskParallelIndexHash = executiongroup.AddGroupToLabel("task-parallel-index-hash")

	// AnnotationKeyTaskParallelIndex annotations is added on Pods to indicate the parallel
	// index of the task in JSON format.
	AnnotationKeyTaskParallelIndex = executiongroup.AddGroupToLabel("task-parallel-index")
)

Functions

func GetContainerStartTime

func GetContainerStartTime(pod *corev1.Pod) metav1.Time

GetContainerStartTime returns the latest timestamp that any container started running.

func GetContainerTerminateTime

func GetContainerTerminateTime(pod *corev1.Pod) metav1.Time

GetContainerTerminateTime returns the latest timestamp at which any container terminated.

func GetPodConditionInitialized

func GetPodConditionInitialized(pod *corev1.Pod) *corev1.PodCondition

GetPodConditionInitialized returns the PodInitialized pod condition.

func GetPodConditionScheduled

func GetPodConditionScheduled(pod *corev1.Pod) *corev1.PodCondition

GetPodConditionScheduled returns the PodScheduled pod condition.

func GetTerminationStatus

func GetTerminationStatus(container *corev1.ContainerStatus) *corev1.ContainerStateTerminated

GetTerminationStatus returns either the current container's Terminated or LastTerminateState.

func IsPodConditionScheduled

func IsPodConditionScheduled(pod *corev1.Pod) bool

IsPodConditionScheduled returns whether the pod has been scheduled. This does not necessarily mean that the pod is currently in a Scheduled state.

func LabelPodsForJob

func LabelPodsForJob(rj *execution.Job) labels.Set

LabelPodsForJob returns a labels.Set that labels all Pods for a Job.

func NewExecutor

func NewExecutor(
	clientsets controllercontext.Clientsets, informers controllercontext.Informers, rj *execution.Job,
) tasks.Executor

NewExecutor returns a new tasks.Executor which lists and operates on Pods.

func NewFactory

NewFactory returns a new tasks.ExecutorFactory to return a Pod task executor.

func NewPod

func NewPod(
	rj *execution.Job,
	template *corev1.PodTemplateSpec,
	index tasks.TaskIndex,
) (*corev1.Pod, error)

NewPod returns a new Pod object for the given Job.

func SubstitutePodSpec added in v0.2.0

func SubstitutePodSpec(
	rj *execution.Job,
	podSpec v1.PodSpec,
	taskSpec variablecontext.TaskSpec,
) v1.PodSpec

SubstitutePodSpec returns a PodSpec after substituting context variables.

Types

type PodTask

type PodTask struct {
	*corev1.Pod
	// contains filtered or unexported fields
}

PodTask is a wrapper around Pod that fulfils Task.

func NewPodTask

func NewPodTask(pod *corev1.Pod, client v1.PodInterface) *PodTask

func (*PodTask) GetContainerStates

func (p *PodTask) GetContainerStates() []execution.TaskContainerState

func (*PodTask) GetFinishTimestamp

func (p *PodTask) GetFinishTimestamp() metav1.Time

func (*PodTask) GetKind

func (p *PodTask) GetKind() string

func (*PodTask) GetParallelIndex added in v0.2.0

func (p *PodTask) GetParallelIndex() (*execution.ParallelIndex, bool)

func (*PodTask) GetReasonMessage

func (p *PodTask) GetReasonMessage() (string, string)

func (*PodTask) GetResult

func (p *PodTask) GetResult() execution.TaskResult

func (*PodTask) GetRetryIndex

func (p *PodTask) GetRetryIndex() (int64, bool)

func (*PodTask) GetRunningTimestamp

func (p *PodTask) GetRunningTimestamp() metav1.Time

func (*PodTask) GetState

func (p *PodTask) GetState() execution.TaskState

func (*PodTask) GetTaskRef

func (p *PodTask) GetTaskRef() execution.TaskRef

func (*PodTask) IsFinished

func (p *PodTask) IsFinished() bool

func (*PodTask) IsOOMKilled

func (p *PodTask) IsOOMKilled() bool

func (*PodTask) RequiresKillWithDeletion

func (p *PodTask) RequiresKillWithDeletion() bool

RequiresKillWithDeletion returns true if the Task should be killed with deletion instead of active deadline. Currently, we only enforce deletion if the Pod is not yet scheduled, otherwise we should always use kill timestamp to allow for graceful termination.

type PodTaskClient

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

PodTaskClient operates on Pod tasks.

func NewPodTaskClient

func NewPodTaskClient(client v1.PodInterface, rj *execution.Job) *PodTaskClient

func (*PodTaskClient) CreateIndex

func (p *PodTaskClient) CreateIndex(ctx context.Context, index tasks.TaskIndex) (tasks.Task, error)

func (*PodTaskClient) Delete

func (p *PodTaskClient) Delete(ctx context.Context, name string, force bool) error

func (*PodTaskClient) Get

func (p *PodTaskClient) Get(ctx context.Context, name string) (tasks.Task, error)

func (*PodTaskClient) Index

func (p *PodTaskClient) Index(ctx context.Context, index tasks.TaskIndex) (tasks.Task, error)

type PodTaskLister

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

PodTaskLister lists Pod tasks.

func NewPodTaskLister

func NewPodTaskLister(
	podLister corev1lister.PodLister, client v1.PodInterface, rj *execution.Job,
) *PodTaskLister

func (*PodTaskLister) Get

func (p *PodTaskLister) Get(name string) (jobtasks.Task, error)

func (*PodTaskLister) Index

func (p *PodTaskLister) Index(index jobtasks.TaskIndex) (jobtasks.Task, error)

func (*PodTaskLister) List

func (p *PodTaskLister) List() ([]jobtasks.Task, error)

Jump to

Keyboard shortcuts

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