executor

package
v0.0.0-...-0351873 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AverageDuration

func AverageDuration(in []time.Duration) time.Duration

func StopAfterCancel

func StopAfterCancel(_ *RunnerResult) bool

func StopOnFailure

func StopOnFailure(result *RunnerResult) bool

Returns true (stop the runner) when the last command returned non 0 exit code.

func StopOnSuccess

func StopOnSuccess(result *RunnerResult) bool

Types

type ExecutionResult

type ExecutionResult struct {
	Command  string
	ExitCode int
	Duration time.Duration
}

func ExecuteToStdout

func ExecuteToStdout(command string) (out *ExecutionResult)

type Executor

type Executor func(string) *ExecutionResult

type Runner

type Runner struct {
	Command   string
	Exec      Executor
	Condition RunnerStopCheck
	// contains filtered or unexported fields
}

func (*Runner) Loop

func (r *Runner) Loop() *RunnerResult

func (*Runner) LoopCLI

func (r *Runner) LoopCLI() int

Executes Runner.Loop but prints output instead of reporting it and returns exit code.

type RunnerResult

type RunnerResult struct {
	Command      string
	Attempts     uint
	Performance  *TimingStatistics
	LastExitCode int
}

func (*RunnerResult) Record

func (rr *RunnerResult) Record(result *ExecutionResult)

func (*RunnerResult) String

func (rr *RunnerResult) String() string

type RunnerStopCheck

type RunnerStopCheck func(*RunnerResult) bool

Takes a runner result and returns if the runner should stop or not.

func StopAfterRuns

func StopAfterRuns(runs int) RunnerStopCheck

type TimingStatistics

type TimingStatistics struct {
	Fastest time.Duration
	Slowest time.Duration
	Average time.Duration
	Total   time.Duration
	// contains filtered or unexported fields
}

func (*TimingStatistics) Record

func (t *TimingStatistics) Record(in time.Duration)

func (*TimingStatistics) String

func (t *TimingStatistics) String() string

Jump to

Keyboard shortcuts

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