Documentation
¶
Overview ¶
Package scheduling decides which worker should host an actor.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoCapacity = errors.New("no free workers satisfy the constraints")
ErrNoCapacity is returned by Schedule when no free worker satisfies the constraints.
Functions ¶
This section is empty.
Types ¶
type Constraints ¶
type Constraints struct {
// SandboxClass must equal the worker's sandbox class. Snapshots are not
// portable across sandbox classes, so this is never relaxed.
SandboxClass string
// TemplateSelector and ActorSelector must both match the worker's labels.
TemplateSelector labels.Selector
ActorSelector labels.Selector
// RequiredNodes, when non-empty, restricts placement to workers running
// on one of these nodes. Used when the actor's latest snapshot is local
// to specific node VMs.
RequiredNodes []string
// Limits are the actor's declared resource limits, named as a Worker names
// the capacity it reports, so the two subtract.
Limits *ateapipb.Resources
}
Constraints describes what a worker must satisfy to host an actor.
type Option ¶
type Option func(*scheduler)
Option configures the Scheduler returned by New.
type Scheduler ¶
type Scheduler interface {
// Schedule returns a free worker satisfying constraints.
// Returns ErrNoCapacity when no free worker satisfies the requested constraints.
Schedule(ctx context.Context, constraints Constraints) (*ateapipb.Worker, error)
// Applies reports whether worker satisfies non-capacity constraints. Capacity
// is excluded so an existing assignment does not make its Worker ineligible.
Applies(worker *ateapipb.Worker, constraints Constraints) bool
// HasRoom reports whether worker's remaining capacity admits one more actor
// of this size, in every dimension. Independent of Applies.
HasRoom(worker *ateapipb.Worker, constraints Constraints) bool
}
Scheduler answers placement questions against the current worker fleet.
func New ¶
func New(source WorkerSource, opts ...Option) Scheduler
New returns a Scheduler placing onto workers reported by source.
type WorkerSource ¶
WorkerSource provides the whole fleet of workers.
Click to show internal directories.
Click to hide internal directories.