Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrSkippedExecution pass this error to `Execution.Stop` if you wish to mark // it as skipped. ErrSkippedExecution = errors.New("skipped execution") ErrUnexpected = errors.New("error unexpected, docker has returned exit code -1, maybe wrong user?") ErrMaxTimeRunning = errors.New("the job has exceed the maximum allowed time running.") ErrLocalImageNotFound = errors.New("couldn't find image on the host") )
View Source
var ( ErrEmptyScheduler = errors.New("unable to start a empty scheduler.") ErrEmptySchedule = errors.New("unable to add a job with a empty schedule.") )
Functions ¶
Types ¶
type BareJob ¶
type BareJob struct { Schedule string Name string Command string // contains filtered or unexported fields }
func (*BareJob) GetCommand ¶
func (*BareJob) GetSchedule ¶
func (*BareJob) Middlewares ¶
func (c *BareJob) Middlewares() []Middleware
func (*BareJob) NotifyStart ¶
func (j *BareJob) NotifyStart()
func (*BareJob) NotifyStop ¶
func (j *BareJob) NotifyStop()
func (*BareJob) Use ¶
func (c *BareJob) Use(ms ...Middleware)
type Context ¶
type ExecJob ¶
type ExecJob struct { BareJob `mapstructure:",squash"` Client *docker.Client `json:"-"` Container string User string `default:"root"` TTY bool `default:"false"` Environment []string // contains filtered or unexported fields }
func NewExecJob ¶
func (*ExecJob) Middlewares ¶
func (c *ExecJob) Middlewares() []Middleware
func (*ExecJob) Use ¶
func (c *ExecJob) Use(ms ...Middleware)
type Execution ¶
type Execution struct { ID string Date time.Time Duration time.Duration IsRunning bool Failed bool Skipped bool Error error OutputStream, ErrorStream *circbuf.Buffer `json:"-"` }
Execution contains all the information relative to a Job execution.
func NewExecution ¶
func NewExecution() *Execution
NewExecution returns a new Execution, with a random ID
type Job ¶
type Job interface { GetName() string GetSchedule() string GetCommand() string Middlewares() []Middleware Use(...Middleware) Run(*Context) error Running() int32 NotifyStart() NotifyStop() }
type LocalJob ¶
func NewLocalJob ¶
func NewLocalJob() *LocalJob
func (*LocalJob) Middlewares ¶
func (c *LocalJob) Middlewares() []Middleware
func (*LocalJob) Use ¶
func (c *LocalJob) Use(ms ...Middleware)
type Middleware ¶
type Middleware interface { // Run is called instead of the original `Job.Run`, you MUST call to `ctx.Run` // inside of the middleware `Run` function otherwise you will broken the // Job workflow. Run(*Context) error // ContinueOnStop, If return true the Run function will be called even if // the execution is stopped ContinueOnStop() bool }
Middleware can wrap any job execution, allowing to execution code before or/and after of each `Job.Run`
type RunJob ¶
type RunJob struct { BareJob `mapstructure:",squash"` Client *docker.Client `json:"-"` User string `default:"root"` TTY bool `default:"false"` // do not use bool values with "default:true" because if // user would set it to "false" explicitly, it still will be // changed to "true" https://github.com/mcuadros/ofelia/issues/135 // so lets use strings here as workaround Delete string `default:"true"` Pull string `default:"true"` Image string Network string Hostname string Container string Volume []string Environment []string // contains filtered or unexported fields }
func (*RunJob) Middlewares ¶
func (c *RunJob) Middlewares() []Middleware
func (*RunJob) Use ¶
func (c *RunJob) Use(ms ...Middleware)
type RunServiceJob ¶
type RunServiceJob struct { BareJob `mapstructure:",squash"` Client *docker.Client `json:"-"` User string `default:"root"` TTY bool `default:"false"` // do not use bool values with "default:true" because if // user would set it to "false" explicitly, it still will be // changed to "true" https://github.com/mcuadros/ofelia/issues/135 // so lets use strings here as workaround Delete string `default:"true"` Image string Network string }
func NewRunServiceJob ¶
func NewRunServiceJob(c *docker.Client) *RunServiceJob
func (*RunServiceJob) Middlewares ¶
func (c *RunServiceJob) Middlewares() []Middleware
func (*RunServiceJob) Run ¶
func (j *RunServiceJob) Run(ctx *Context) error
func (*RunServiceJob) Use ¶
func (c *RunServiceJob) Use(ms ...Middleware)
type Scheduler ¶
func NewScheduler ¶
func (*Scheduler) Middlewares ¶
func (c *Scheduler) Middlewares() []Middleware
func (*Scheduler) Use ¶
func (c *Scheduler) Use(ms ...Middleware)
Click to show internal directories.
Click to hide internal directories.