Documentation

Index

Constants

View Source
const (
	// DefaultDeadlineDuration - The default timeout is 5 second
	DefaultDeadlineDuration = time.Second * 5
	// DefaultStopOnFailure is used to set the number of failures before a task is disabled
	DefaultStopOnFailure = 10
)
View Source
const (
	CONFIG_CONSTRAINTS = `` /* 291-byte string literal not displayed */

)

Variables

View Source
var (

	// HandlerRegistrationName registers a handler with the event manager
	HandlerRegistrationName = "scheduler"

	// ErrMetricManagerNotSet - The error message for metricManager is not set
	ErrMetricManagerNotSet = errors.New("MetricManager is not set.")
	// ErrSchedulerNotStarted - The error message for scheduler is not started
	ErrSchedulerNotStarted = errors.New("Scheduler is not started.")
	// ErrTaskAlreadyRunning - The error message for task is already running
	ErrTaskAlreadyRunning = errors.New("Task is already running.")
	// ErrTaskAlreadyStopped - The error message for task is already stopped
	ErrTaskAlreadyStopped = errors.New("Task is already stopped.")
	// ErrTaskDisabledNotRunnable - The error message for task is disabled and cannot be started
	ErrTaskDisabledNotRunnable = errors.New("Task is disabled. Cannot be started.")
	// ErrTaskDisabledNotStoppable - The error message for when a task is disabled and cannot be stopped
	ErrTaskDisabledNotStoppable = errors.New("Task is disabled. Only running tasks can be stopped.")
)
View Source
var (

	// ErrTaskNotFound - The error message for task not found
	ErrTaskNotFound = errors.New("Task not found")
	// ErrTaskNotStopped - The error message for task must be stopped
	ErrTaskNotStopped = errors.New("Task must be stopped")
	// ErrTaskHasAlreadyBeenAdded - The error message for task has already been added
	ErrTaskHasAlreadyBeenAdded = errors.New("Task has already been added")
	// ErrTaskDisabledOnFailures - The error message for task disabled due to consecutive failures
	ErrTaskDisabledOnFailures = errors.New("Task disabled due to consecutive failures")
	// ErrTaskNotDisabled - The error message for task must be disabled
	ErrTaskNotDisabled = errors.New("Task must be disabled")
)
View Source
var (
	WorkflowStateLookup = map[WorkflowState]string{
		WorkflowStopped: "Stopped",
		WorkflowStarted: "Started",
	}

	ErrNullCollectNode        = errors.New("Missing collection node in workflow map")
	ErrNoMetricsInCollectNode = errors.New("Collection node has not metrics defined to collect")
)

    WorkflowStateLookup map and error vars

    View Source
    var (
    
    	// Flags consumed by snapd
    	Flags = []cli.Flag{flSchedulerQueueSize, flSchedulerPoolSize}
    )

    Functions

    func CollectQSizeOption

    func CollectQSizeOption(v uint) workManagerOption

      CollectQSizeOption sets the collector queue size(length) and returns the previous queue option state.

      func CollectWkrSizeOption

      func CollectWkrSizeOption(v uint) workManagerOption

        CollectWkrSizeOption sets the collector worker pool size and returns the previous collector worker pool state.

        func New

        func New(cfg *Config) *scheduler

          New returns an instance of the scheduler The MetricManager must be set before the scheduler can be started. The MetricManager must be started before it can be used.

          func ProcessQSizeOption

          func ProcessQSizeOption(v uint) workManagerOption

            ProcessQSizeOption sets the processor queue size(length) and returns the previous queue option state.

            func ProcessWkrSizeOption

            func ProcessWkrSizeOption(v uint) workManagerOption

              ProcessWkrSizeOption sets the processor worker pool size and return the previous processor worker pool state.

              func PublishQSizeOption

              func PublishQSizeOption(v uint) workManagerOption

                PublishQSizeOption sets the publisher queue size(length) and returns the previous queue option state.

                func PublishWkrSizeOption

                func PublishWkrSizeOption(v uint) workManagerOption

                  PublishWkrSizeOption sets the publisher worker pool size and returns the previous previous publisher worker pool state.

                  Types

                  type Config

                  type Config struct {
                  	WorkManagerQueueSize uint `json:"work_manager_queue_size"yaml:"work_manager_queue_size"`
                  	WorkManagerPoolSize  uint `json:"work_manager_pool_size"yaml:"work_manager_pool_size"`
                  }

                    holds the configuration passed in through the SNAP config file

                    Note: if this struct is modified, then the switch statement in the
                          UnmarshalJSON method in this same file needs to be modified to
                          match the field mapping that is defined here
                    

                    func GetDefaultConfig

                    func GetDefaultConfig() *Config

                      get the default snapd configuration

                      func (*Config) UnmarshalJSON

                      func (c *Config) UnmarshalJSON(data []byte) error

                        UnmarshalJSON unmarshals valid json into a Config. An example Config can be found at github.com/intelsdi-x/snap/blob/master/examples/configs/snap-config-sample.json

                        type TaskWatcher

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

                          TaskWatcher struct type

                          func (*TaskWatcher) Close

                          func (t *TaskWatcher) Close() error

                            Close stops watching a task. Cannot be restarted.

                            type WorkflowState

                            type WorkflowState int

                              WorkflowState int type

                              const (
                              	WorkflowStopped WorkflowState = iota
                              	WorkflowStarted
                              )

                                Workflow state constants

                                Directories

                                Path Synopsis