Documentation
¶
Overview ¶
Package scheduler provides an implementation of workflow.Runner that works by scheduling tasks to be executed by a set of workers.
Index ¶
- type Config
- type Scheduler
- func (s *Scheduler) Cancel(ctx context.Context, tasks ...*workflow.Task) error
- func (s *Scheduler) DialFrom(ctx context.Context, from net.Addr) (wire.Conn, error)
- func (s *Scheduler) Listen(ctx context.Context, writer workflow.RecordWriter, stream *workflow.Stream) error
- func (s *Scheduler) RegisterManifest(_ context.Context, manifest *workflow.Manifest) error
- func (s *Scheduler) RegisterMetrics(reg prometheus.Registerer) error
- func (s *Scheduler) Service() services.Service
- func (s *Scheduler) Start(ctx context.Context, tasks ...*workflow.Task) error
- func (s *Scheduler) UnregisterManifest(ctx context.Context, manifest *workflow.Manifest) error
- func (s *Scheduler) UnregisterMetrics(reg prometheus.Registerer)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Logger for optional log messages.
Logger log.Logger
// Listener is the listener used for communication with workers.
Listener wire.Listener
}
Config holds configuration options for Scheduler.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler is a service that can schedule tasks to connected worker instances.
func New ¶
New creates a new instance of a scheduler. Use Scheduler.Service to manage the lifecycle of the returned scheduler.
func (*Scheduler) Cancel ¶
Cancel requests cancellation of the specified tasks. Cancel returns an error if any of the tasks were not found.
func (*Scheduler) DialFrom ¶
DialFrom connects to the scheduler using its local transport. The from address denotes the connecting peer.
func (*Scheduler) Listen ¶
func (s *Scheduler) Listen(ctx context.Context, writer workflow.RecordWriter, stream *workflow.Stream) error
Listen binds the caller as the receiver of the specified stream. Listening on a stream prevents tasks from reading from it.
func (*Scheduler) RegisterManifest ¶
RegisterManifest registers a manifest to use with the scheduler, recording all streams and task inside of it for use.
func (*Scheduler) RegisterMetrics ¶
func (s *Scheduler) RegisterMetrics(reg prometheus.Registerer) error
RegisterMetrics registers metrics about s to report to reg.
func (*Scheduler) Service ¶
Service returns the service used to manage the lifecycle of the Scheduler.
func (*Scheduler) Start ¶
Start begins executing the provided tasks in the background. Start returns an error if any of the Tasks are unrecognized.
The provided handler will be called whenever any of the provided tasks change state.
Canceling the provided context does not cancel started tasks. Use Scheduler.Cancel to cancel started tasks.
func (*Scheduler) UnregisterManifest ¶
UnregisterManifest removes a manifest from the scheduler.
func (*Scheduler) UnregisterMetrics ¶
func (s *Scheduler) UnregisterMetrics(reg prometheus.Registerer)
UnregisterMetrics unregisters metrics about s from reg.