package scheduler
import "github.com/docker/swarmkit/manager/scheduler"
Index ¶
- type ConstraintFilter
- func (f *ConstraintFilter) Check(n *NodeInfo) bool
- func (f *ConstraintFilter) SetTask(t *api.Task) bool
- type Expr
- type Filter
- type NodeInfo
- type Pipeline
- func NewPipeline() *Pipeline
- func (p *Pipeline) Process(n *NodeInfo) bool
- func (p *Pipeline) SetTask(t *api.Task)
- type PluginFilter
- type ReadyFilter
- type ResourceFilter
- type Scheduler
Types ¶
type ConstraintFilter ¶
type ConstraintFilter struct {
// contains filtered or unexported fields
}
ConstraintFilter selects only nodes that match certain labels.
func (*ConstraintFilter) Check ¶
func (f *ConstraintFilter) Check(n *NodeInfo) bool
Check returns true if the task's constraint is supported by the given node.
func (*ConstraintFilter) SetTask ¶
func (f *ConstraintFilter) SetTask(t *api.Task) bool
SetTask returns true when the filter is enable for a given task.
type Expr ¶
type Expr struct { Key string // contains filtered or unexported fields }
Expr defines a constraint
func ParseExprs ¶
ParseExprs parses list of constraints into Expr list
func (*Expr) Match ¶
Match checks if the Expr matches the target strings.
type Filter ¶
type Filter interface { // SetTask returns true when the filter is enabled for a given task // and assigns the task to the filter. It returns false if the filter // isn't applicable to this task. For instance, a constraints filter // would return `false` if the task doesn't contain any constraints. SetTask(*api.Task) bool // Check returns true if the task assigned by SetTask can be scheduled // into the given node. This function should not be called if SetTask // returned false. Check(*NodeInfo) bool }
Filter checks whether the given task can run on the given node. A filter may only operate
type NodeInfo ¶
NodeInfo contains a node and some additional metadata.
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline runs a set of filters against nodes.
func NewPipeline ¶
func NewPipeline() *Pipeline
NewPipeline returns a pipeline with the default set of filters.
func (*Pipeline) Process ¶
Process a node through the filter pipeline. Returns true if all filters pass, false otherwise.
func (*Pipeline) SetTask ¶
SetTask sets up the filters to process a new task. Once this is called, Process can be called repeatedly to try to assign the task various nodes.
type PluginFilter ¶
type PluginFilter struct {
// contains filtered or unexported fields
}
PluginFilter checks that the node has a specific volume plugin installed
func (*PluginFilter) Check ¶
func (f *PluginFilter) Check(n *NodeInfo) bool
Check returns true if the task can be scheduled into the given node. TODO(amitshukla): investigate storing Plugins as a map so it can be easily probed
func (*PluginFilter) SetTask ¶
func (f *PluginFilter) SetTask(t *api.Task) bool
SetTask returns true when the filter is enabled for a given task.
type ReadyFilter ¶
type ReadyFilter struct { }
ReadyFilter checks that the node is ready to schedule tasks.
func (*ReadyFilter) Check ¶
func (f *ReadyFilter) Check(n *NodeInfo) bool
Check returns true if the task can be scheduled into the given node.
func (*ReadyFilter) SetTask ¶
func (f *ReadyFilter) SetTask(_ *api.Task) bool
SetTask returns true when the filter is enabled for a given task.
type ResourceFilter ¶
type ResourceFilter struct {
// contains filtered or unexported fields
}
ResourceFilter checks that the node has enough resources available to run the task.
func (*ResourceFilter) Check ¶
func (f *ResourceFilter) Check(n *NodeInfo) bool
Check returns true if the task can be scheduled into the given node.
func (*ResourceFilter) SetTask ¶
func (f *ResourceFilter) SetTask(t *api.Task) bool
SetTask returns true when the filter is enabled for a given task.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler assigns tasks to nodes.
func New ¶
func New(store *store.MemoryStore) *Scheduler
New creates a new scheduler.
func (*Scheduler) Run ¶
Run is the scheduler event loop.
func (*Scheduler) Stop ¶
func (s *Scheduler) Stop()
Stop causes the scheduler event loop to stop running.
Source Files ¶
constraint.go expr.go filter.go indexed_node_heap.go nodeinfo.go pipeline.go scheduler.go
- Version
- v1.12.0 (latest)
- Published
- Jul 26, 2016
- Platform
- linux/amd64
- Imports
- 13 packages
- Last checked
- 3 hours ago –
Tools for package owners.