tasks

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(tasks []Task) error

Run executes a slice of Tasks.

Types

type ConcurrentTask

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

ConcurrentTask represent a set of tasks that are executed concurrently using an errgroup.Group. Externally it act as a Task, and as such, can be included on a workflow or wrapped on a retry. Keep in mmind in the latter case that, given the nature of errgroup.Group, on failure the whole task set will be retried, including tasks that potentially have already finished.

func NewConcurrentTask

func NewConcurrentTask(name string, tasks ...Task) *ConcurrentTask

func (*ConcurrentTask) Name

func (c *ConcurrentTask) Name() string

func (*ConcurrentTask) Run

func (c *ConcurrentTask) Run() error

func (*ConcurrentTask) String

func (c *ConcurrentTask) String() string

type DockerTaskConfig

type DockerTaskConfig struct {
	Volumes          []string
	Env              []string
	WorkingDirectory string
	Image            string
	Args             []string
}

type ExecTask

type ExecTask struct {
	Args []string
	// contains filtered or unexported fields
}

ExecTask is a task backed by os/exec.

func NewDockerTask

func NewDockerTask(name string, config DockerTaskConfig) ExecTask

func NewExecTask

func NewExecTask(name string, args []string) ExecTask

func (ExecTask) Name

func (t ExecTask) Name() string

func (ExecTask) Run

func (t ExecTask) Run() error

func (ExecTask) String

func (t ExecTask) String() string

type RetryTask

type RetryTask struct {
	BackOff backoff.BackOff
	Task    Task
}

RetryTask is a task to retry wrapped tasks.

func NewRetryTask

func NewRetryTask(backOff backoff.BackOff, task Task) RetryTask

func (RetryTask) Name

func (t RetryTask) Name() string

func (RetryTask) Run

func (t RetryTask) Run() error

func (RetryTask) String

func (t RetryTask) String() string

type Task

type Task interface {
	Name() string
	Run() error

	fmt.Stringer
}

Task represents a piece of work to perform.

Jump to

Keyboard shortcuts

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