scheduler

package
v0.0.0-...-437b0eb Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CheckInterval = time.Millisecond * 1000
	WaitTimeout   = time.Second * 600
)

CheckInterval is an interval between rechecking the tree for updates

Variables

This section is empty.

Functions

func Deploy

func Deploy(sched interfaces.Scheduler, options interfaces.DependencyGraphOptions, inplace bool, stopChan <-chan struct{}) (string, error)

Deploy deploys the dependency graph either in-place or by creating deployment task for a standalone process

func EnsureNoCycles

func EnsureNoCycles(dependencies []client.Dependency, resdefs map[string]client.ResourceDefinition) error

EnsureNoCycles ensures that dependency graph has no cycles

func FromConfig

FromConfig deserializes setting map produced by Serialize method into Scheduler and DependencyGraphOptions objects

func GetStatus

GetStatus returns deployment status

func New

func New(client client.Interface, selector labels.Selector, concurrency int) interfaces.Scheduler

New creates and initializes instance of Scheduler

func ProcessDeploymentTasks

func ProcessDeploymentTasks(client client.Interface, stopChan <-chan struct{})

ProcessDeploymentTasks picks deployment tasks (configMap objects) one by one in chronological order, restores graph options from it and deploys the graph. This is the main function of long-running deployment process

Types

type ScheduledResource

type ScheduledResource struct {
	Requires   []string
	RequiredBy []string
	Started    bool
	Ignored    bool
	Error      error
	Existing   bool

	interfaces.Resource
	// parentKey -> dependencyMetadata
	Meta map[string]map[string]string
	sync.RWMutex
	// contains filtered or unexported fields
}

ScheduledResource is a wrapper for Resource with attached relationship data

func (*ScheduledResource) GetNodeReport

func (sr *ScheduledResource) GetNodeReport(name string) report.NodeReport

GetNodeReport acts as a more verbose version of IsBlocked. It performs the same check as IsBlocked, but returns the DeploymentReport

func (*ScheduledResource) IsBlocked

func (sr *ScheduledResource) IsBlocked() bool

IsBlocked checks whether a scheduled resource can be created. It checks status of resources it depends on, via API

func (*ScheduledResource) Key

func (sr *ScheduledResource) Key() string

Key returns resource identifier with optional suffix

func (*ScheduledResource) RequestCreation

func (sr *ScheduledResource) RequestCreation(toCreate chan *ScheduledResource) bool

RequestCreation does not create a scheduled resource immediately, but updates status and puts the scheduled resource to corresponding channel. Returns true if scheduled resource creation was actually requested, false otherwise.

func (*ScheduledResource) ResetStatus

func (sr *ScheduledResource) ResetStatus()

ResetStatus resets cached status of scheduled resource

func (*ScheduledResource) Status

Status either returns cached copy of resource's status or retrieves it via Resource.Status. Only ResourceReady is cached to avoid inconsistency for resources that may go to failure state over time so that if resource becomes ready it stays in this status for the whole deployment duration. Errors returned by the resource are never cached, however if AC sees permanent problem with resource it may set the error field

func (*ScheduledResource) Wait

func (sr *ScheduledResource) Wait(checkInterval time.Duration, timeout time.Duration, stopChan <-chan struct{}) (bool, error)

Wait periodically checks resource status and returns if the resource processing is finished, regardless successful or not. The actual result of processing could be obtained from returned error.

Jump to

Keyboard shortcuts

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