Documentation ¶
Index ¶
- Constants
- type Coordinator
- func (c *Coordinator) RunCancelled(ctx context.Context, runID platform.ID) error
- func (c *Coordinator) RunForced(ctx context.Context, task *taskmodel.Task, run *taskmodel.Run) error
- func (c *Coordinator) RunRetried(ctx context.Context, task *taskmodel.Task, run *taskmodel.Run) error
- func (c *Coordinator) TaskCreated(ctx context.Context, task *taskmodel.Task) error
- func (c *Coordinator) TaskDeleted(ctx context.Context, id platform.ID) error
- func (c *Coordinator) TaskUpdated(ctx context.Context, from, to *taskmodel.Task) error
- type CoordinatorOption
- type Executor
- type SchedulableTask
Constants ¶
const DefaultLimit = 1000
DefaultLimit is the maximum number of tasks that a given taskd server can own
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator is the intermediary between the scheduling/executing system and the rest of the task system
func NewCoordinator ¶
func NewCoordinator(log *zap.Logger, scheduler scheduler.Scheduler, executor Executor, opts ...CoordinatorOption) *Coordinator
func (*Coordinator) RunCancelled ¶
RunCancelled speaks directly to the executor to cancel a task run
func (*Coordinator) RunForced ¶
func (c *Coordinator) RunForced(ctx context.Context, task *taskmodel.Task, run *taskmodel.Run) error
RunForced speaks directly to the Executor to run a task immediately
func (*Coordinator) RunRetried ¶
func (c *Coordinator) RunRetried(ctx context.Context, task *taskmodel.Task, run *taskmodel.Run) error
RunRetried speaks directly to the executor to re-try a task run immediately
func (*Coordinator) TaskCreated ¶
TaskCreated asks the scheduler to schedule the newly created task
func (*Coordinator) TaskDeleted ¶
TaskDeleted asks the scheduler to release the deleted task
func (*Coordinator) TaskUpdated ¶
TaskUpdated releases the task if it is being disabled, and schedules it otherwise
type CoordinatorOption ¶
type CoordinatorOption func(*Coordinator)
func WithLimitOpt ¶
func WithLimitOpt(i int) CoordinatorOption
type Executor ¶
type Executor interface { ManualRun(ctx context.Context, id platform.ID, runID platform.ID) (executor.Promise, error) Cancel(ctx context.Context, runID platform.ID) error }
Executor is an abstraction of the task executor with only the functions needed by the coordinator
type SchedulableTask ¶
SchedulableTask is a wrapper around the Task struct, giving it methods to make it compatible with the scheduler
func NewSchedulableTask ¶
func NewSchedulableTask(task *taskmodel.Task) (SchedulableTask, error)
NewSchedulableTask transforms an influxdb task to a schedulable task type
func (SchedulableTask) ID ¶
func (t SchedulableTask) ID() scheduler.ID
func (SchedulableTask) LastScheduled ¶
func (t SchedulableTask) LastScheduled() time.Time
LastScheduled parses the task's LatestCompleted value as a Time object
func (SchedulableTask) Offset ¶
func (t SchedulableTask) Offset() time.Duration
Offset returns a time.Duration for the Task's offset property
func (SchedulableTask) Schedule ¶
func (t SchedulableTask) Schedule() scheduler.Schedule
Schedule takes the time a Task is scheduled for and returns a Schedule object