Documentation
¶
Index ¶
- Variables
- type Job
- type JobConfig
- type JobID
- type JobListResult
- type JobSubmitResult
- type Locker
- type Reporter
- type Scheduler
- func (s *Scheduler) Jobs() []JobListResult
- func (s *Scheduler) Run(ctx context.Context) error
- func (s *Scheduler) StartJob(id JobID) error
- func (s *Scheduler) StopJob(id JobID) error
- func (s *Scheduler) Submit(jc *JobConfig) *JobSubmitResult
- func (s *Scheduler) WaitJob(ctx context.Context, id JobID) (*JobListResult, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var InvalidJobID = JobID(0)
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job interface {
// Run starts running the task and blocks until the context is done or
// an error occurs. Run may be called again after an error or timeout to
// retry the job so implemententions must ensure that Run resets any
// necessary state.
Run(context.Context) error
Done() <-chan struct{}
}
type JobConfig ¶
type JobConfig struct {
// Reporter is a job report
Reporter *Reporter
// Name is a human readable name for the job for use in logging
Name string
// Tasks is a list of tasks the job performs
Tasks []string
// Job is the job that will be executed.
Job Job
// Locker is an optional lock that must be taken before the job can execute.
Locker Locker
// RestartOnFailure controls whether the job should be restarted if it stops with an error.
RestartOnFailure bool
// RestartOnCompletion controls whether the job should be restarted if it stops without an error.
RestartOnCompletion bool
// RestartDelay is the amount of time to wait before restarting a stopped job
RestartDelay time.Duration
// Type is a human readable type for the job for use in logging.
Type string
// Params is a map of additional parameters that add human readable context to the job.
Params map[string]string
// StartedAt is the time the job started running.
StartedAt time.Time
// EndedAt is the time the job stopped running, either through successful completion or failure. Reset if job is restarted.
EndedAt time.Time
// contains filtered or unexported fields
}
type JobListResult ¶ added in v0.8.2
type JobSubmitResult ¶ added in v0.8.2
type Reporter ¶ added in v0.14.0
type Reporter struct {
// Current Height is the current height of the job
CurrentHeight int64
}
func (*Reporter) UpdateCurrentHeight ¶ added in v0.14.0
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
func NewScheduler ¶
func NewSchedulerDaemon ¶
func NewSchedulerDaemon(mctx helpers.MetricsCtx, lc fx.Lifecycle) *Scheduler
func (*Scheduler) Jobs ¶
func (s *Scheduler) Jobs() []JobListResult
func (*Scheduler) Submit ¶
func (s *Scheduler) Submit(jc *JobConfig) *JobSubmitResult
Click to show internal directories.
Click to hide internal directories.