scheduler

package
v1.25.0-116.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const StateMachineType = "scheduler.Scheduler"

Unique type identifier for this state machine.

View Source
const (
	TaskTypeSchedule = "scheduler.Schedule"
)

Variables

View Source
var TransitionSchedulerActivate = hsm.NewTransition(
	[]enumsspb.SchedulerState{enumsspb.SCHEDULER_STATE_WAITING},
	enumsspb.SCHEDULER_STATE_WAITING,
	func(scheduler Scheduler, event EventSchedulerActivate) (hsm.TransitionOutput, error) {
		tasks, err := scheduler.RegenerateTasks(nil)
		return hsm.TransitionOutput{Tasks: tasks}, err
	})
View Source
var UseExperimentalHsmScheduler = dynamicconfig.NewNamespaceBoolSetting(
	"scheduler.use-experimental-hsm-scheduler",
	false,
	"When true, use the experimental scheduler implemented using the HSM framework instead of workflows")

Functions

func MachineCollection

func MachineCollection(tree *hsm.Node) hsm.Collection[Scheduler]

MachineCollection creates a new typed [statemachines.Collection] for callbacks.

func RegisterExecutor

func RegisterExecutor(
	registry *hsm.Registry,
	executorOptions TaskExecutorOptions,
	config *Config,
) error

func RegisterStateMachine

func RegisterStateMachine(r *hsm.Registry) error

func RegisterTaskSerializers

func RegisterTaskSerializers(reg *hsm.Registry) error

Types

type Config

type Config struct {
}

func ConfigProvider

func ConfigProvider(dc *dynamicconfig.Collection) *Config

type EventSchedulerActivate

type EventSchedulerActivate struct{}

EventSchedulerActivate is triggered when the scheduler state machine should wake up and perform work.

type ScheduleTask

type ScheduleTask struct {
	Deadline time.Time
}

func (ScheduleTask) Concurrent

func (ScheduleTask) Concurrent() bool

func (ScheduleTask) Kind

func (t ScheduleTask) Kind() hsm.TaskKind

func (ScheduleTask) Type

func (ScheduleTask) Type() string

type ScheduleTaskSerializer

type ScheduleTaskSerializer struct{}

func (ScheduleTaskSerializer) Deserialize

func (ScheduleTaskSerializer) Deserialize(data []byte, kind hsm.TaskKind) (hsm.Task, error)

func (ScheduleTaskSerializer) Serialize

func (ScheduleTaskSerializer) Serialize(hsm.Task) ([]byte, error)

type Scheduler

type Scheduler struct {
	*schedspb.HsmSchedulerState
}

Callback state machine.

func NewScheduler

func NewScheduler(args *schedspb.StartScheduleArgs) Scheduler

NewCallback creates a new callback in the STANDBY state from given params.

func (Scheduler) RegenerateTasks

func (s Scheduler) RegenerateTasks(*hsm.Node) ([]hsm.Task, error)

func (Scheduler) SetState

func (s Scheduler) SetState(state enumsspb.SchedulerState)

func (Scheduler) State

func (s Scheduler) State() enumsspb.SchedulerState

type TaskExecutorOptions

type TaskExecutorOptions struct {
}

func TaskExecutorOptionsProvider

func TaskExecutorOptionsProvider() TaskExecutorOptions

Jump to

Keyboard shortcuts

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