schedule

package
Version: v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SCHEDULED = "SCHEDULED"
	RETRY     = "RETRY"
	MANUAL    = "MANUAL"
)
View Source
const (
	OFFSET_FROM_START intervalMode = iota
	ACTUAL_START_TIME
)
View Source
const (
	LLComponentName = instance.FrameworkPrefix + "CommandScheduledTasks"
)

Variables

This section is empty.

Functions

func NewAllowRetryErrorf

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

func NewInvocationManager

func NewInvocationManager(t *Task) *invocationManager

Types

type AllowRetryError

type AllowRetryError struct {
	// contains filtered or unexported fields
}

func (*AllowRetryError) Error

func (e *AllowRetryError) Error() string

type Task

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

func (t *Task) FullName() string

type TaskInvocationSummary

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

type TaskLogic

type TaskLogic interface {
	ExecuteTask(c chan TaskStatusUpdate) error
}

type TaskScheduler

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

func (ts *TaskScheduler) AllowAccess() error

func (*TaskScheduler) Container

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

Implements ioc.ContainerAccessor

func (*TaskScheduler) PrepareToStop

func (ts *TaskScheduler) PrepareToStop()

func (*TaskScheduler) ReadyToStop

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

func (*TaskScheduler) StartComponent

func (ts *TaskScheduler) StartComponent() error

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

func (*TaskScheduler) Stop

func (ts *TaskScheduler) Stop() error

type TaskStatusUpdate

type TaskStatusUpdate struct {
	Message string
	Status  interface{}
}

func StatusMessagef

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

type TaskStatusUpdateReceiver

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

Jump to

Keyboard shortcuts

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