Help us shape the future of Go! Take the 2026 Go Developer Survey

scheduler

package
v1.233.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateResult

type AggregateResult struct {
	Results []Result
	Err     error
}

AggregateResult contains one result per graph node in stable topological order.

func (*AggregateResult) ResultFor

func (r *AggregateResult) ResultFor(nodeID string) (Result, bool)

ResultFor returns the result for a node ID.

func (*AggregateResult) Success

func (r *AggregateResult) Success() bool

Success reports whether all scheduled nodes completed successfully.

type Dispatcher

type Dispatcher interface {
	Dispatch(ctx context.Context, node *dependency.Node) (Result, error)
}

Dispatcher executes one scheduler node. Tool-specific execution belongs behind this interface so the scheduler remains component-type agnostic.

type DispatcherFunc

type DispatcherFunc func(ctx context.Context, node *dependency.Node) (Result, error)

DispatcherFunc adapts a function into a Dispatcher.

func (DispatcherFunc) Dispatch

func (f DispatcherFunc) Dispatch(ctx context.Context, node *dependency.Node) (Result, error)

Dispatch calls f(ctx, node).

type Option

type Option func(*Scheduler)

Option configures a Scheduler.

func WithFailFast

func WithFailFast(failFast bool) Option

WithFailFast controls whether the scheduler stops scheduling after a node error.

func WithMaxConcurrency

func WithMaxConcurrency(maxConcurrency int) Option

WithMaxConcurrency sets the number of workers allowed to run at once.

func WithNodeCompleteHook

func WithNodeCompleteHook(hook func(*dependency.Node, Result)) Option

WithNodeCompleteHook registers a callback after a node dispatch finishes.

func WithNodeStartHook

func WithNodeStartHook(hook func(*dependency.Node)) Option

WithNodeStartHook registers a callback before a node is dispatched.

type Result

type Result struct {
	NodeID string
	Node   dependency.Node
	Status Status
	Value  any
	Err    error
}

Result is the deterministic per-node outcome returned in AggregateResult.

func (Result) Success

func (r Result) Success() bool

Success reports whether the node completed successfully.

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler manages ready-queue DAG execution with a bounded worker pool.

func New

func New(graph *dependency.Graph, dispatcher Dispatcher, opts ...Option) *Scheduler

New creates a scheduler for graph and dispatcher.

func (*Scheduler) Run

Run executes the graph with ready-queue scheduling.

type Status

type Status string

Status describes the scheduler outcome for a node.

const (
	StatusSucceeded Status = "succeeded"
	StatusFailed    Status = "failed"
	StatusSkipped   Status = "skipped"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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