Documentation
¶
Overview ¶
Package workflow runs DAGs of cron.Jobs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ConfigError ¶
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
func (*ConfigError) Unwrap ¶
func (e *ConfigError) Unwrap() error
type Execution ¶
type Execution struct {
ID string
StartedAt time.Time
Duration time.Duration
Results map[string]Result
Errors map[string]error
Steps map[string]StepReport
}
Execution is the result of one Workflow run.
type Inputs ¶ added in v0.3.0
Inputs holds dependency outputs keyed by step name. Plain-Job, failed, and skipped dependencies yield nil.
type Step ¶
type Step struct {
Name string
Job cron.Job
Fn StepFunc // alternative to Job; receives dependency outputs
Deps []Dep
Timeout time.Duration // per-run cap; zero means none
Retry cron.RetryPolicy // per-run retry; zero means none
}
Step is one node in the DAG. Exactly one of Job or Fn must be set.
func NewStepFunc ¶ added in v0.3.0
NewStepFunc is NewStep for a StepFunc whose output feeds dependent steps.
type StepFunc ¶ added in v0.3.0
StepFunc is a step body that consumes dependency outputs and produces its own, letting data flow through the DAG.
type StepReport ¶ added in v0.3.0
type StepReport struct {
Result Result
Err error
Output any // StepFunc return value; nil for plain Jobs
StartedAt time.Time // zero if the step never ran
Duration time.Duration
}
StepReport is one step's outcome with timing and output.
type Workflow ¶
type Workflow struct {
// contains filtered or unexported fields
}
Workflow is a DAG of Steps.
func New ¶
New constructs a Workflow. It copies Step.Deps and returns *ConfigError for duplicate steps, unknown dependencies, or cycles.
func (*Workflow) WithOnComplete ¶
WithOnComplete returns a shallow copy with cb installed. cb runs before Run returns.