runner

package
v0.0.0-...-b973768 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo interface {
	Set(jobID string, runner Runner)
	Get(jobID string) Runner
	Remove(jobID string)
	Items() map[string]Runner
	Count() int
}

Repo is a small wrapper around a concurrent map that provides the ability to store and retrieve Runners in a thread-safe way.

func NewRepo

func NewRepo() Repo

NewRepo ...

type Return

type Return struct {
	AtomReturn atom.Return // Final atom.Return Determines if/how chain continues running.
	Tries      uint        // Number of tries this run, not including any previous tries
}

Return ...

type Runner

type Runner interface {
	// Run runs the job, blocking until it has completed or when Stop is called.
	// If the job fails, Run will retry it as many times as the job is configured
	// to be retried. When the job successfully completes, or reaches the maximum number
	// of retry attempts, Run returns the final state of the job.
	Run(ctx context.Context) Return

	// Stop stops the job if it's running. The job is responsible for stopping
	// quickly because Stop blocks while waiting for the job to stop.
	Stop(ctx context.Context) error
}

A Runner runs and manages one job in a job chain. The job must implement the job.Job interface.

func NewRunner

func NewRunner(realJob job.Job, req *request.Request, totalTries uint, name string, retry uint, retryWait time.Duration, logger *infra.Logger) Runner

NewRunner ...

Jump to

Keyboard shortcuts

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