exec

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package exec schedules markers over the follow-edge dependency DAG: topological order, stable-sorted ready set, cycle detection, capped parallelism.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	ID      string
	Err     error
	Skipped bool
	Reason  string
}

Result is the outcome of a task. Exactly one of Err being set, Skipped being true, or a clean success holds. Skipped means the task never ran because its dependency failed, was missing, or formed a cycle.

func Execute

func Execute(ctx context.Context, tasks []Task, workers int) []Result

Execute runs tasks honouring their from-edges: a task runs only after the task it follows has succeeded. Independent tasks run first, up to workers at a time; followers run in later waves. A task whose dependency fails, is unknown, or lies on a cycle is skipped rather than aborting the run, so one bad marker never sinks the rest. Results are returned in input order.

type Task

type Task struct {
	ID        string
	From      string
	Label     string
	FromLabel string
	Run       func(ctx context.Context) error
}

Task is a node in the follow-edge dependency graph: an optional ID others may follow, the ID it follows (From, empty when independent), and the work to run. Run is provider-agnostic - the pipeline supplies a closure that resolves a producer or a follower - so the scheduler stays a pure graph executor.

ID and From may be opaque, namespaced keys; Label and FromLabel are their human-readable forms used in skip reasons so an internal key never reaches the user. Each defaults to its key when unset.

Jump to

Keyboard shortcuts

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