scheduler

package
v3.7.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package scheduler provides an implementation of workflow.Runner that works by scheduling tasks to be executed by a set of workers.

Index

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

func New(config Config) (*Scheduler, error)

New creates a new instance of a scheduler. Use Scheduler.Service to manage the lifecycle of the returned scheduler.

func (*Scheduler) Cancel

func (s *Scheduler) Cancel(ctx context.Context, tasks ...*workflow.Task) error

Cancel requests cancellation of the specified tasks. Cancel returns an error if any of the tasks were not found.

func (*Scheduler) DialFrom

func (s *Scheduler) DialFrom(ctx context.Context, from net.Addr) (wire.Conn, error)

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

func (s *Scheduler) RegisterManifest(_ context.Context, manifest *workflow.Manifest) error

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

func (s *Scheduler) Service() services.Service

Service returns the service used to manage the lifecycle of the Scheduler.

func (*Scheduler) Start

func (s *Scheduler) Start(ctx context.Context, tasks ...*workflow.Task) error

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

func (s *Scheduler) UnregisterManifest(ctx context.Context, manifest *workflow.Manifest) error

UnregisterManifest removes a manifest from the scheduler.

func (*Scheduler) UnregisterMetrics

func (s *Scheduler) UnregisterMetrics(reg prometheus.Registerer)

UnregisterMetrics unregisters metrics about s from reg.

Directories

Path Synopsis
Package wire provides the wire protocol for how peers scheduler peers communicate.
Package wire provides the wire protocol for how peers scheduler peers communicate.

Jump to

Keyboard shortcuts

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