granitic: Index | Files

package schedule

import ""


Package Files

controltask.go error.go invocation.go manager.go parse.go schedule.go scheduler.go task.go


const (
    RETRY     = "RETRY"
    MANUAL    = "MANUAL"
const (
    OFFSET_FROM_START intervalMode = iota
const (
    LLComponentName = instance.FrameworkPrefix + "CommandScheduledTasks"

func NewAllowRetryErrorf Uses

func NewAllowRetryErrorf(template string, args ...interface{}) error

func NewInvocationManager Uses

func NewInvocationManager(t *Task) *invocationManager

type AllowRetryError Uses

type AllowRetryError struct {
    // contains filtered or unexported fields

func (*AllowRetryError) Error Uses

func (e *AllowRetryError) Error() string

type Task Uses

type Task struct {

    // A human-readable name for the task
    Name string
    // An optional unique ID for the task (the IoC component name for this task will be used if not specified)
    Id  string
    // The name of the IoC component implementing TaskLogic that actually performs this task
    Component string
    // The maximum number of overlapping instances of the task that are allowed to run. Zero means only one instance of this task can run at a time
    MaxOverlapping int
    // If set to true, suppress warning messages being logged when a task is scheduled to run while another instance is already running
    NoWarnOnOverlap bool
    // A human-readable expression (in English) of how frequently the task should be run - see package docs
    Every string

    // If set to true, any status updates messages sent from the task to the scheduler will be logged
    LogStatusMessages bool

    // The name of a component that is interested in receiving status updates from a running task
    StatusUpdateReceiver string

    // If set to true the task will never run
    Disabled bool

    // The number of times an invocation of this task should be re-tried if the task fails with an AllowRetryError
    MaxRetries int

    // A human-readable expression (in English) of how the interval to wait between a failure and a retry (e.g. 1 minute, 20 seconds)
    // Must be set if MaxRetries > 0
    RetryInterval string
    // contains filtered or unexported fields

Task describes when and how frequently a scheduled task should be executed and the component that provides a method to actually perform the task

func (*Task) FullName Uses

func (t *Task) FullName() string

type TaskInvocationSummary Uses

type TaskInvocationSummary struct {
    TaskName        string
    TaskId          string
    StartedAt       time.Time
    InvocationCount uint64

type TaskLogic Uses

type TaskLogic interface {
    ExecuteTask(c chan TaskStatusUpdate) error

type TaskScheduler Uses

type TaskScheduler struct {
    State ioc.ComponentState
    // Logger used by Granitic framework components. Automatically injected.
    FrameworkLogger     logging.Logger
    FrameworkLogManager *logging.ComponentLoggerManager
    // contains filtered or unexported fields

func (*TaskScheduler) AllowAccess Uses

func (ts *TaskScheduler) AllowAccess() error

func (*TaskScheduler) Container Uses

func (ts *TaskScheduler) Container(container *ioc.ComponentContainer)

Implements ioc.ContainerAccessor

func (*TaskScheduler) PrepareToStop Uses

func (ts *TaskScheduler) PrepareToStop()

func (*TaskScheduler) ReadyToStop Uses

func (ts *TaskScheduler) ReadyToStop() (bool, error)

func (*TaskScheduler) StartComponent Uses

func (ts *TaskScheduler) StartComponent() error

StartComponent Finds any schedules, parses them and verifies the component they reference implements schedule.TaskLogic

func (*TaskScheduler) Stop Uses

func (ts *TaskScheduler) Stop() error

type TaskStatusUpdate Uses

type TaskStatusUpdate struct {
    Message string
    Status  interface{}

func StatusMessagef Uses

func StatusMessagef(format string, a ...interface{}) TaskStatusUpdate

type TaskStatusUpdateReceiver Uses

type TaskStatusUpdateReceiver interface {
    Receive(summary TaskInvocationSummary, update TaskStatusUpdate)

Package schedule imports 11 packages (graph) and is imported by 1 packages. Updated 2018-11-14. Refresh now. Tools for package owners.