runner

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRunPaused    = errors.New("run paused")
	ErrRunCancelled = errors.New("run cancelled")
)

Functions

func NewRunID

func NewRunID() string

func PrepareRun

PrepareRun materializes the stable runtime identity and pending node records before execution starts. Async callers can persist this state and return the run ID without racing the scheduler goroutine.

Types

type DefaultDispatcher

type DefaultDispatcher struct{}

func NewDefaultDispatcher

func NewDefaultDispatcher() *DefaultDispatcher

func (*DefaultDispatcher) Dispatch

type DefaultScheduler

type DefaultScheduler struct {
	ExecutorDispatcher executor.Dispatcher
	NodeDispatcher     NodeDispatcher
	Store              wfruntime.Store
	Sink               EventSink
	ResultReporter     ResultReporter
	HeartbeatReporter  HeartbeatReporter
	RunController      RunController
}

func NewDefaultScheduler

func NewDefaultScheduler(executors *executor.Registry, store wfruntime.Store) *DefaultScheduler

func (*DefaultScheduler) Run

type Dispatcher

type Dispatcher = NodeDispatcher

Backward compatible alias.

type Engine

type Engine struct {
	Compiler  planning.Compiler
	Scheduler Scheduler
}

Engine is the new runtime facade: definition -> plan -> run.

func NewEngine

func NewEngine(compiler planning.Compiler, scheduler Scheduler) *Engine

func (*Engine) RunVersion

type EventSink

type EventSink interface {
	Emit(ctx context.Context, event wfruntime.RunEvent)
}

type ExecutorResolver

type ExecutorResolver interface {
	Resolve(execType string) (executor.Executor, bool)
}

ExecutorResolver keeps compatibility with existing call sites.

type Heartbeat

type Heartbeat struct {
	RunID          string          `json:"run_id"`
	NodeID         string          `json:"node_id"`
	ExecutorType   string          `json:"executor_type,omitempty"`
	ExternalTaskID string          `json:"external_task_id,omitempty"`
	Status         executor.Status `json:"status,omitempty"`
	Message        string          `json:"message,omitempty"`
	At             time.Time       `json:"at"`
	Metadata       map[string]any  `json:"metadata,omitempty"`
}

type HeartbeatReporter

type HeartbeatReporter interface {
	ReportHeartbeat(ctx context.Context, beat Heartbeat) error
}

HeartbeatReporter is useful for async/remote execution visibility.

type MemoryRunController

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

func NewMemoryRunController

func NewMemoryRunController() *MemoryRunController

func (*MemoryRunController) Clear

func (c *MemoryRunController) Clear(runID string)

func (*MemoryRunController) Get

func (c *MemoryRunController) Get(runID string) RunCommand

func (*MemoryRunController) Set

func (c *MemoryRunController) Set(runID string, cmd RunCommand)

type NodeDispatcher

type NodeDispatcher interface {
	Dispatch(plan *planning.ExecutionPlan, run *wfruntime.WorkflowRun) []string
}

NodeDispatcher decides which nodes are ready based on execution state.

type NopHeartbeatReporter

type NopHeartbeatReporter struct{}

func (*NopHeartbeatReporter) ReportHeartbeat

func (r *NopHeartbeatReporter) ReportHeartbeat(context.Context, Heartbeat) error

type NopResultReporter

type NopResultReporter struct{}

func (*NopResultReporter) ReportResult

type ResultReporter

type ResultReporter interface {
	ReportResult(ctx context.Context, task executor.ExecuteTask, result executor.ExecuteResult) error
}

ResultReporter persists/forwards normalized task results.

type RunCommand

type RunCommand string
const (
	RunCommandNone   RunCommand = ""
	RunCommandPause  RunCommand = "pause"
	RunCommandCancel RunCommand = "cancel"
)

type RunController

type RunController interface {
	Get(runID string) RunCommand
	Set(runID string, cmd RunCommand)
	Clear(runID string)
}

type Scheduler

type Scheduler interface {
	Run(ctx context.Context, plan *planning.ExecutionPlan, run *wfruntime.WorkflowRun) (*wfruntime.WorkflowRun, error)
}

type StoreResultReporter

type StoreResultReporter struct {
	Store wfruntime.Store
}

StoreResultReporter forwards normalized results into runtime events.

func (*StoreResultReporter) ReportResult

Jump to

Keyboard shortcuts

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