tasks

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	Lister() TaskLister
	Client() TaskClient
}

Executor is a task executor interface.

type ExecutorFactory

type ExecutorFactory interface {
	ForJob(rj *execution.Job) (Executor, error)
}

ExecutorFactory produces task executors.

type Task

type Task interface {
	// GetOwnerReferences returns the list of
	GetOwnerReferences() []metav1.OwnerReference

	// GetName returns the Task's name.
	GetName() string

	// GetTaskRef returns an immutable copy of the Task.
	GetTaskRef() execution.TaskRef

	// GetKind returns the kind of the task.
	GetKind() string

	// GetRetryIndex returns the retry index for the task.
	// All tasks should be numbered sequentially starting from 1 for a single job.
	GetRetryIndex() (int64, bool)

	// GetParallelIndex returns the parallel index for the task.
	GetParallelIndex() (*execution.ParallelIndex, bool)

	// GetDeletionTimestamp returns the timestamp that the task was requested to be deleted.
	GetDeletionTimestamp() *metav1.Time
}

Task is implemented by Kubernetes resource definitions that encapsulate a single Job task on the cluster. This could be backed by a Pod, etc.

type TaskClient

type TaskClient interface {
	// CreateIndex creates a new Task with the given index.
	CreateIndex(ctx context.Context, index TaskIndex) (task Task, err error)

	// Get returns a single Task from apiserver.
	Get(ctx context.Context, name string) (Task, error)

	// Index returns a single Task for the given index from apiserver.
	Index(ctx context.Context, index TaskIndex) (Task, error)

	// Delete will delete the Task with the given name.
	Delete(ctx context.Context, name string, force bool) error
}

TaskClient implements methods to perform operations on the apiserver.

type TaskIndex added in v0.2.0

type TaskIndex struct {
	Retry    int64
	Parallel execution.ParallelIndex
}

TaskIndex contains indexes for a single task.

type TaskLister

type TaskLister interface {
	// Get a single task by name.
	Get(name string) (Task, error)

	// Index will return the task given the TaskIndex for a single Job.
	Index(index TaskIndex) (Task, error)

	// List will return all tasks for a single Job. Note that this may be
	// prohibitively expensive since it may require an exhaustive linear search.
	List() ([]Task, error)
}

TaskLister implements methods to list Tasks from informer cache.

Jump to

Keyboard shortcuts

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