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 worker that meets the constraints has room")
ErrNoCapacity is returned by Schedule when no worker that meets the constraints has room. The cause can be full workers, or no worker that meets the constraints at all.
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
// RequiredRuntime, when non-nil, restricts placement to workers whose
// DefaultRuntime or RestorableRuntimes can restore a snapshot stamped with
// this runtime.
RequiredRuntime *ateapipb.SandboxRuntime
// 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 Scheduler ¶
type Scheduler interface {
// Schedule returns a worker that meets constraints and has room.
// Returns ErrNoCapacity when no worker that meets constraints has room.
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.