dag

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 29 Imported by: 7

Documentation

Index

Constants

View Source
const MaxCoroutineConcurrency = 10000

Variables

This section is empty.

Functions

func DefineExecutionOrder

func DefineExecutionOrder(
	components []*component.Component,
	rootDir string,
	option ...ExecOption,
) (TargetNodeMap, Priorities, error)

DefineExecutionOrder defines the execution order over all components. The `rootDir` is the `BaseDir` if `input.Config.RelativeToRoot` is used. Options:

  • The target selection defines which target nodes are of interest, if `nil` all target leaf nodes are taken as selection.
  • The `inputPathChanges` denote the path changes which will propagate the changed flags on the target nodes. If its `nil` all targets are considered changed by default.

func Execute added in v0.28.0

func Execute(
	targets TargetNodeMap,
	prios Priorities,
	runnerFactory factory.IFactory,
	dispatcher toolchain.IDispatcher,
	config config.IConfig,
	rootDir string,
	parallel bool,
	opts ...ExecuteOption,
) error

Execute executes the DAG. If no dispatcher is given, the toolchain dispatch is not done.

func ExecuteConcurrent added in v0.28.0

func ExecuteConcurrent(
	targetNodes TargetNodeMap,
	runnerFactory factory.IFactory,
	toolchainDispatcher toolchain.IDispatcher,
	config config.IConfig,
	rootDir string,
	opts ...ExecuteOption,
) (allErrors error)

ExecuteConcurrent executes the DAG concurrent. TODO: Refactor to better length and less nested.

func ExecuteNormal added in v0.28.0

func ExecuteNormal(
	prios Priorities,
	runnerFactory factory.IFactory,
	toolchainDispatcher toolchain.IDispatcher,
	config config.IConfig,
	rootDir string,
	opts ...ExecuteOption,
) error

ExecuteNormal executes the DAG non-concurrent. If no dispatcher is given, the toolchain dispatch is not done.

func ExecuteRunner

func ExecuteRunner(
	log log.ILog,
	comp *component.Component,
	targetID target.ID,
	stepIdx step.Index,
	runnerIdx int,
	runner runner.IRunner,
	toolchainName string,
	toolchainDispatcher toolchain.IDispatcher,
	config config.IConfig,
	rootDir string,
) error

Types

type ExecArgs added in v0.28.0

type ExecArgs struct {
	Tags []string `yaml:"tags"`
}

type ExecOption added in v0.38.0

type ExecOption func(*opts) error

func WithInputChanges added in v0.38.0

func WithInputChanges(inputPathChanges []string) ExecOption

WithInputChanges set the input path changes to be considered.

func WithTargetSelection added in v0.38.0

func WithTargetSelection(sel *TargetSelection) ExecOption

WithTargetSelection sets a target selection directly.

func WithTargetSelectionAdd added in v0.38.0

func WithTargetSelectionAdd(ids ...target.ID) ExecOption

WithTargetSelectionAdd adds target ids to the selection.

func WithTargetsByStageFromComponents added in v0.38.0

func WithTargetsByStageFromComponents(
	comps []*component.Component,
	stageFilter stage.Stage,
) ExecOption

WithTargetsByStageFromComponents turns components with optional stage into a target selection.

type ExecuteOption added in v0.28.0

type ExecuteOption func(*execOption) error

func WithTags added in v0.28.0

func WithTags(tag ...string) ExecuteOption

WithTags adds executable tags tags.Tag to the executable options.

type InputChanges

type InputChanges struct {
	// If this input change set contains changes.
	Changed bool

	// Paths which have changed (this list may not represent all paths)
	// because of early returns.
	Changes []string
}

InputChanges represents the tracking state of the input change set.

type Priorities

type Priorities []PrioritySet

func (*Priorities) Format

func (prios *Priorities) Format() string

Format formats the priorities.

type PrioritySet

type PrioritySet struct {
	Priority int
	Nodes    []*TargetNode
}

type RunnerData

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

type RunnerStatus

type RunnerStatus struct {
	Failed   bool
	CompName string
	TargetID target.ID
	StepIdx  step.Index
	RunnerID runner.RegisterID
}

type RunnerStatuses

type RunnerStatuses []RunnerStatus

func (RunnerStatuses) Log

func (s RunnerStatuses) Log()

type TargetNode

type TargetNode struct {
	// The target to which this Node belongs.
	Target *target.Config

	// Where this target belongs to.
	Config *component.Config
	Comp   *component.Component

	// The execution priority.
	// The higher the earlier it should be executed.
	Priority int

	// All child nodes which depend on this node.
	// Forward in execution direction.
	Forward []*TargetNode

	// All nodes on which this node depends.
	// Backward in execution direction.
	Backward []*TargetNode

	// Tracking inputs on this node.
	Inputs TargetNodeChanges
}

type TargetNodeChanges

type TargetNodeChanges struct {
	// Flag if the inputs for this target have changed.
	Changed bool

	// ChangedByDependency denotes if the target has changed due to a dependency.
	// If so, then detection of own changed `Paths` are skipped!
	// Asserts: Can only be `true` if `Changed` is true and also then
	// `Paths` will be `nil` because we skip own detection.
	ChangedByDependency bool

	// Changed paths for this component.
	Paths []string

	// Changed paths by all parents.
	AccumulatedPaths []string
}

func (*TargetNodeChanges) All

func (i *TargetNodeChanges) All() []string

All returns all changes, accumulated ones from depend targets as well own changed paths.

func (*TargetNodeChanges) Merge

func (i *TargetNodeChanges) Merge(other *TargetNodeChanges)

Merge merges two input changes together.

type TargetNodeMap

type TargetNodeMap = map[target.ID]*TargetNode

type TargetSelection

type TargetSelection = set.Unordered[target.ID]

Jump to

Keyboard shortcuts

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