job

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LabelKeyAdmissionErrorMessage stores any user error encountered when creating
	// tasks. This usually implies a misconfiguration that we cannot retry further,
	// hence the Job should transit into a terminal state.
	LabelKeyAdmissionErrorMessage = executiongroup.AddGroupToLabel("admission-error")
)

Functions

func ConcurrentTasks

func ConcurrentTasks(tasks []jobtasks.Task, fn func(task jobtasks.Task) error) error

ConcurrentTasks provides a utility method to perform a method on all given Tasks concurrently.

func FilterTaskRefs added in v0.2.0

func FilterTaskRefs(taskRefs []execution.TaskRef, filter TaskRefFilter) []execution.TaskRef

FilterTaskRefs will filter the given TaskRefs according to the TaskRefFilter.

func FindTaskRef

func FindTaskRef(rj *execution.Job, task tasks.Task) *execution.TaskRef

FindTaskRef returns the Task that matches the given Task's name.

func GenerateTaskName added in v0.2.0

func GenerateTaskName(name string, index tasks.TaskIndex) (string, error)

GenerateTaskName generates a deterministic task name given a TaskIndex.

func GenerateTaskRefs

func GenerateTaskRefs(existing []execution.TaskRef, tasks []tasks.Task) []execution.TaskRef

GenerateTaskRefs reconciles tasks into an existing list of TaskRefs. If any task is no longer present, it will transition to TaskDeletedFinalStateUnknown.

func GetAdmissionErrorMessage

func GetAdmissionErrorMessage(rj *execution.Job) (string, bool)

GetAdmissionErrorMessage returns the error message if the Job contains the AdmissionErrorMessage annotation.

func GetCondition

func GetCondition(rj *execution.Job) (execution.JobCondition, error)

GetCondition returns a consolidated JobCondition computed from TaskRefs. nolint: gocognit

func GetForceDeleteTimeout added in v0.2.0

func GetForceDeleteTimeout(cfg *configv1alpha1.JobExecutionConfig) time.Duration

GetForceDeleteTimeout returns the timeout before the controller starts force deletion.

func GetPendingTimeout

func GetPendingTimeout(rj *execution.Job, cfg *configv1alpha1.JobExecutionConfig) time.Duration

GetPendingTimeout returns the pending timeout for the given Job.

func GetPhase

func GetPhase(rj *v1alpha1.Job) v1alpha1.JobPhase

GetPhase returns the phase of a Job based on the tasks and Job status so far. It expects that the JobCondition is up-to-date.

func GetResultPtr

func GetResultPtr(result v1alpha1.JobResult) *v1alpha1.JobResult

GetResultPtr converts a JobResult to a *JobResult.

func GetTTLAfterFinished

func GetTTLAfterFinished(rj *execution.Job, cfg *configv1alpha1.JobExecutionConfig) time.Duration

GetTTLAfterFinished returns the TTL after a Job is finished.

func GetTaskRef

func GetTaskRef(existing *execution.TaskRef, task tasks.Task) execution.TaskRef

GetTaskRef returns the TaskRef given a Task.

func IsActive

func IsActive(rj *execution.Job) bool

IsActive returns true if the Job is considered active. An active job is one that is started and not terminal.

func IsQueued

func IsQueued(rj *execution.Job) bool

IsQueued returns true if the Job is queued. A queued job is one that is not started and not terminal.

func IsStarted

func IsStarted(rj *execution.Job) bool

IsStarted returns true if the Job is started.

func MarkAdmissionError

func MarkAdmissionError(rj *execution.Job, msg string)

MarkAdmissionError updates a Job to add the AdmissionError annotation.

func SortTaskRefs

func SortTaskRefs(taskRefs []execution.TaskRef)

SortTaskRefs will sort the given TaskRefs by CreationTimestamp in ascending order.

func UpdateJobTaskRefs

func UpdateJobTaskRefs(rj *execution.Job, tasks []tasks.Task) *execution.Job

UpdateJobTaskRefs will update the TaskRefs in the Job's status given a list of tasks. Will return a new copy of the Job whose fields are updated.

func UpdateTaskRefDeletedStatusIfNotSet

func UpdateTaskRefDeletedStatusIfNotSet(
	rj *execution.Job, taskName string, status execution.TaskStatus,
) *execution.Job

UpdateTaskRefDeletedStatusIfNotSet updates the DeletedStatus for a named Task if not already set.

Types

type TaskRefFilter added in v0.2.0

type TaskRefFilter func(ref execution.TaskRef) bool

Jump to

Keyboard shortcuts

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