planning

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxNodeLoopIterations  = 1000
	MaxNodeRetryAttempts   = 10
	MaxNodeRetryBackoff    = 5 * time.Minute
	MaxWorkflowConcurrency = 1024
)

Variables

View Source
var ErrNilDefinition = errors.New("workflow definition is nil")

Functions

func LoopGroupIndexVariable

func LoopGroupIndexVariable(groupID string) string

func LoopGroupItemVariable

func LoopGroupItemVariable(groupID string) string

func ParseLoopGroupVariable

func ParseLoopGroupVariable(key string) (groupID string, kind string, ok bool)

Types

type BranchEdge

type BranchEdge struct {
	To        string `json:"to"`
	Condition string `json:"condition,omitempty"`
	Priority  int    `json:"priority,omitempty"`
	Label     string `json:"label,omitempty"`
}

type BranchMeta

type BranchMeta struct {
	From  string       `json:"from"`
	Mode  string       `json:"mode,omitempty"`
	Edges []BranchEdge `json:"edges"`
}

type Compiler

type Compiler interface {
	Compile(version *definition.WorkflowVersion) (*ExecutionPlan, error)
}

type DefaultCompiler

type DefaultCompiler struct {
	Now func() time.Time
}

func NewCompiler

func NewCompiler() *DefaultCompiler

func (*DefaultCompiler) Compile

type ExecutionPlan

type ExecutionPlan struct {
	PlanID            string                `json:"plan_id"`
	WorkflowID        string                `json:"workflow_id"`
	WorkflowVersionID string                `json:"workflow_version_id"`
	MaxConcurrency    int                   `json:"max_concurrency"`
	FailFast          bool                  `json:"fail_fast,omitempty"`
	EntryNodes        []string              `json:"entry_nodes"`
	ExitNodes         []string              `json:"exit_nodes"`
	Adjacency         map[string][]string   `json:"adjacency"`
	Dependencies      map[string][]string   `json:"dependencies"`
	TopologicalOrder  []string              `json:"topological_order"`
	Nodes             map[string]PlanNode   `json:"nodes"`
	Branches          map[string]BranchMeta `json:"branches,omitempty"`
	BackEdges         map[string]BranchMeta `json:"back_edges,omitempty"`
	LoopGroups        map[string]LoopGroup  `json:"loop_groups,omitempty"`
	CreatedAt         time.Time             `json:"created_at"`
}

type InputBinding

type InputBinding struct {
	Source    string `json:"source,omitempty"`
	From      string `json:"from,omitempty"`
	Path      string `json:"path,omitempty"`
	Label     string `json:"label,omitempty"`
	As        string `json:"as,omitempty"`
	Required  bool   `json:"required,omitempty"`
	Default   any    `json:"default,omitempty"`
	Transform string `json:"transform,omitempty"`
}

type InputSpec

type InputSpec struct {
	Mode     string         `json:"mode,omitempty"`
	Bindings []InputBinding `json:"bindings,omitempty"`
}

type LoopGroup

type LoopGroup struct {
	ID            string        `json:"id"`
	Start         string        `json:"start"`
	End           string        `json:"end"`
	Mode          string        `json:"mode"`
	MaxIterations int           `json:"max_iterations"`
	CountBinding  *InputBinding `json:"count_binding,omitempty"`
	Scope         []string      `json:"scope"`
	Parent        string        `json:"parent,omitempty"`
	Depth         int           `json:"depth,omitempty"`
}

type LoopPolicy

type LoopPolicy struct {
	MaxIterations int           `json:"max_iterations,omitempty"`
	Condition     string        `json:"condition,omitempty"`
	Mode          string        `json:"mode,omitempty"`
	CountBinding  *InputBinding `json:"count_binding,omitempty"`
}

type ParamTemplate

type ParamTemplate struct {
	Segments []ParamTemplateSegment `json:"segments"`
}

type ParamTemplateSegment

type ParamTemplateSegment struct {
	Type    string        `json:"type"`
	Value   string        `json:"value,omitempty"`
	Binding *InputBinding `json:"binding,omitempty"`
}

type PlanNode

type PlanNode struct {
	ID              string                   `json:"id"`
	Name            string                   `json:"name"`
	Type            string                   `json:"type,omitempty"`
	ExecutorType    string                   `json:"executor_type"`
	ExecutorRef     string                   `json:"executor_ref,omitempty"`
	ExecutorConf    map[string]any           `json:"executor_conf,omitempty"`
	Input           any                      `json:"input,omitempty"`
	InputSpec       *InputSpec               `json:"input_spec,omitempty"`
	Params          map[string]any           `json:"params,omitempty"`
	ParamBindings   map[string]InputBinding  `json:"param_bindings,omitempty"`
	ParamTemplates  map[string]ParamTemplate `json:"param_templates,omitempty"`
	Retry           RetryPolicy              `json:"retry,omitempty"`
	Loop            *LoopPolicy              `json:"loop,omitempty"`
	Timeout         time.Duration            `json:"timeout,omitempty"`
	ContinueOnError bool                     `json:"continue_on_error,omitempty"`
}

type RetryPolicy

type RetryPolicy struct {
	MaxAttempts int           `json:"max_attempts,omitempty"`
	Backoff     time.Duration `json:"backoff,omitempty"`
	MaxBackoff  time.Duration `json:"max_backoff,omitempty"`
}

Jump to

Keyboard shortcuts

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