task

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCron

func NewCron(cfg []byte, options *config.Options) (*cron.Cron, error)

NewCron creates a new cron runner from config data

Types

type CronEntry

type CronEntry struct {
	Name    string   `yaml:"name"`
	Cron    string   `yaml:"cron"`
	Command []string `yaml:"command"`
	Options map[string]interface{}
}

CronEntry holds a single entry from the crontab YAML file

type Runner

type Runner struct {
	Cmd []string

	MutexName   string
	MutexPrefix string
	MutexTTL    time.Duration

	TaskTTL time.Duration

	RandomWait int

	FireAndForget bool

	Stdout    RunnerPipe
	Stderr    RunnerPipe
	LogBuffer RunnerPipe

	RedisPool *redis.Pool
}

Runner holds all options and runtime data to run a single command

func NewRunner

func NewRunner(cmd []string) *Runner

NewRunner returns new command runner

func (*Runner) Run

func (r *Runner) Run() (int, error)

Run runs the command, duh

type RunnerPipe

type RunnerPipe struct {
	Reader *io.PipeReader
	Writer *io.PipeWriter
}

RunnerPipe is used for reading command output

Jump to

Keyboard shortcuts

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