job

package
v0.0.0-...-eaa370e Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2015 License: MIT Imports: 4 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job interface {
	Config() *JobConfig
	JobConfirmer() JobConfirmer
}

Job contains all nessisary information to run a job on a worker

type JobConfig

type JobConfig struct {
	Name          string          `json:"name"`           // Name the name of the job
	CaptureOutput bool            `json:"capture_output"` // CaptureOutput if this is true, OutputWritter can not be nil!
	OutputWriter  io.Writer       `json:"-"`              // The writter that will be used to process the output (only used if CaptureOutput is true)
	Params        json.RawMessage `json:"params"`         // Params list of parameters to be given to the job at call time
	Type          string          `json:"type"`           // Type describes how this job can be run

	Retries int `json:"retries"` // Retries if this job fails, how many times should we retry
	// contains filtered or unexported fields
}

JobConfig configureation options for a job

func ParseConfig

func ParseConfig(b []byte) (*JobConfig, error)

ParseConfig takes a byte slice, atempts to parse it, and returns the new JobConfig

func (*JobConfig) Raw

func (j *JobConfig) Raw() []byte

type JobConfirmer

type JobConfirmer interface {
	ConfirmJob(j Job) error
}

Confirms that a job has been completed

type JobStats

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

JobStats holds information about a run of a job

func NewJobStats

func NewJobStats() *JobStats

NewJobStats initilizes a JobStats object

func (*JobStats) Duration

func (j *JobStats) Duration() time.Duration

Duration return how long the job took to complete

func (*JobStats) End

func (j *JobStats) End(s Status)

End signals the end of a job

func (*JobStats) Retries

func (j *JobStats) Retries() int

Retries returns the number of retries a job took to complete

func (*JobStats) Retry

func (j *JobStats) Retry()

Retry signal the restart of a job

func (*JobStats) Start

func (j *JobStats) Start()

Start signals the start of a job

func (*JobStats) Status

func (j *JobStats) Status() Status

Status returns the status of the job

func (*JobStats) String

func (j *JobStats) String() string

String return the string representation of the jobStats object

type JobType

type JobType string

type Status

type Status uint8
const (
	STATUS_NEW     Status = 0
	STATUS_STARTED Status = 1
	STATUS_SUCCESS Status = 2
	STATUS_FAILURE Status = 3
	STATUS_RETRY   Status = 4
)

Jump to

Keyboard shortcuts

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