job

package
v1.16.2-beta.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: Apache-2.0 Imports: 12 Imported by: 22

Documentation

Index

Constants

View Source
const (
	// JobTimeout is how long to wait for a job to finish.
	JobTimeout = 15 * time.Minute

	// JobSelectorKey is a job selector name
	JobSelectorKey = "job"
)

Variables

This section is empty.

Functions

func CreateJob

func CreateJob(c clientset.Interface, ns string, job *batchv1.Job) (*batchv1.Job, error)

CreateJob uses c to create job in namespace ns. If the returned error is nil, the returned Job is valid and has been created.

func DeleteJob

func DeleteJob(c clientset.Interface, ns, name string) error

DeleteJob uses c to delete the Job named name in namespace ns. If the returned error is nil, the Job has been deleted.

func EnsureAllJobPodsRunning

func EnsureAllJobPodsRunning(c clientset.Interface, ns, jobName string, parallelism int32) error

EnsureAllJobPodsRunning uses c to check in the Job named jobName in ns is running, returning an error if the expected parallelism is not satisfied.

func FinishTime

func FinishTime(finishedJob *batchv1.Job) metav1.Time

FinishTime returns finish time of the specified job.

func GetJob

func GetJob(c clientset.Interface, ns, name string) (*batchv1.Job, error)

GetJob uses c to get the Job in namespace ns named name. If the returned error is nil, the returned Job is valid.

func GetJobPods

func GetJobPods(c clientset.Interface, ns, jobName string) (*v1.PodList, error)

GetJobPods returns a list of Pods belonging to a Job.

func NewTestJob

func NewTestJob(behavior, name string, rPol v1.RestartPolicy, parallelism, completions int32, activeDeadlineSeconds *int64, backoffLimit int32) *batchv1.Job

NewTestJob returns a Job which does one of several testing behaviors. notTerminate starts a Job that will run effectively forever. fail starts a Job that will fail immediately. succeed starts a Job that will succeed immediately. randomlySucceedOrFail starts a Job that will succeed or fail randomly. failOnce fails the Job the first time it is run and succeeds subsequently. name is the Name of the Job. RestartPolicy indicates the restart policy of the containers in which the Pod is running. Parallelism is the Job's parallelism, and completions is the Job's required number of completions.

func UpdateJob

func UpdateJob(c clientset.Interface, ns string, job *batchv1.Job) (*batchv1.Job, error)

UpdateJob uses c to updated job in namespace ns. If the returned error is nil, the returned Job is valid and has been updated.

func UpdateJobWithRetries

func UpdateJobWithRetries(c clientset.Interface, namespace, name string, applyUpdate func(*batchv1.Job)) (job *batchv1.Job, err error)

UpdateJobWithRetries updates job with retries.

func WaitForAllJobPodsGone

func WaitForAllJobPodsGone(c clientset.Interface, ns, jobName string) error

WaitForAllJobPodsGone waits for all pods for the Job named jobName in namespace ns to be deleted.

func WaitForAllJobPodsRunning

func WaitForAllJobPodsRunning(c clientset.Interface, ns, jobName string, parallelism int32) error

WaitForAllJobPodsRunning wait for all pods for the Job named JobName in namespace ns to become Running. Only use when pods will run for a long time, or it will be racy.

func WaitForJobComplete

func WaitForJobComplete(c clientset.Interface, ns, jobName string, completions int32) error

WaitForJobComplete uses c to wait for completions to complete for the Job jobName in namespace ns.

func WaitForJobDeleting

func WaitForJobDeleting(c clientset.Interface, ns, jobName string) error

WaitForJobDeleting uses c to wait for the Job jobName in namespace ns to have a non-nil deletionTimestamp (i.e. being deleted).

func WaitForJobFailure

func WaitForJobFailure(c clientset.Interface, ns, jobName string, timeout time.Duration, reason string) error

WaitForJobFailure uses c to wait for up to timeout for the Job named jobName in namespace ns to fail.

func WaitForJobFinish

func WaitForJobFinish(c clientset.Interface, ns, jobName string) error

WaitForJobFinish uses c to wait for the Job jobName in namespace ns to finish (either Failed or Complete).

func WaitForJobGone

func WaitForJobGone(c clientset.Interface, ns, jobName string, timeout time.Duration) error

WaitForJobGone uses c to wait for up to timeout for the Job named jobName in namespace ns to be removed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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