Documentation
¶
Index ¶
- Variables
- func BuiltinActionNames() []string
- func DeprecatedSyntaxWarnings(data []byte) []string
- func IsValidExecutorTypeName(name string) bool
- func Load(ctx context.Context, nameOrPath string, opts ...LoadOption) (*core.DAG, error)
- func LoadBaseConfig(ctx BuildContext, file string) (*core.DAG, error)
- func LoadYAML(ctx context.Context, data []byte, opts ...LoadOption) (*core.DAG, error)
- func LoadYAMLWithOpts(ctx context.Context, data []byte, opts BuildOpts) (*core.DAG, error)
- func QuoteRuntimeParams(params []string, paramDefs []core.ParamDef) []string
- func RegisterExecutorTypeName(name string)
- func ResolveEnv(ctx context.Context, dag *core.DAG, params any, opts ResolveEnvOptions) ([]string, error)
- func ResolveRuntimeParams(ctx context.Context, dag *core.DAG, params any, ...) (*core.DAG, error)
- func StepTypeNames() []string
- func TypedUnionDecodeHook() mapstructure.DecodeHookFunc
- func UnregisterExecutorTypeName(name string)
- type BuildContext
- type BuildFlag
- type BuildOpts
- type CustomActionEditorHint
- type HumanTaskInputResult
- type LegacyDefinitionEditorHint
- type LoadOption
- func OnlyMetadata() LoadOption
- func SkipSchemaValidation() LoadOption
- func WithAllowBuildErrors() LoadOption
- func WithBaseConfig(baseDAG string) LoadOption
- func WithBaseConfigContent(content []byte) LoadOption
- func WithBuildEnv(env map[string]string) LoadOption
- func WithDAGsDir(dagsDir string) LoadOption
- func WithDefaultWorkingDir(defaultWorkingDir string) LoadOption
- func WithName(name string) LoadOption
- func WithParams(params any) LoadOption
- func WithSkipBaseHandlers() LoadOption
- func WithSourceFile(sourceFile string) LoadOption
- func WithWorkspaceBaseConfigDir(dir string) LoadOption
- func WithoutEval() LoadOption
- type LoadOptions
- type LoadResult
- type ResolveEnvOptions
- type ResolveEnvResult
- type ResolveRuntimeParamsOptions
- type StepBuildContext
- type Transformer
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidSchedule = errors.New("invalid schedule") ErrScheduleMustBeStringOrArray = errors.New("schedule must be a string or an array of strings") ErrInvalidScheduleType = errors.New("invalid schedule type") ErrDotEnvMustBeStringOrArray = errors.New("dotenv must be a string or an array of strings") ErrPreconditionValueMustBeString = errors.New("precondition value must be a string") ErrPreconditionNegateMustBeBool = errors.New("precondition negate must be a boolean") ErrPreconditionHasInvalidKey = errors.New("precondition has invalid key") ErrPreconditionMustBeArrayOrString = errors.New("precondition must be a string or an array of strings") ErrInvalidStepData = errors.New("invalid step data") ErrStepsMustBeArrayOrMap = errors.New("steps must be an array or a map") ErrContinueOnExitCodeMustBeIntOrArray = errors.New("continue_on.exit_code must be an int or an array of ints") ErrContinueOnOutputMustBeStringOrArray = errors.New("continue_on.output must be a string or an array of strings") ErrContinueOnMustBeStringOrMap = errors.New("continue_on must be a string ('skipped' or 'failed') or an object") ErrContinueOnInvalidStringValue = errors.New("continue_on string value must be 'skipped' or 'failed'") ErrContinueOnFieldMustBeBool = errors.New("value must be a boolean") ErrInvalidSignal = errors.New("invalid signal") ErrDependsMustBeStringOrArray = errors.New("depends must be a string or an array of strings") ErrInvalidEnvValue = errors.New("env config should be map of strings or array of key=value formatted string") ErrInvalidParamValue = errors.New("invalid parameter value") ErrStepCommandIsEmpty = errors.New("step command is empty") ErrStepCommandMustBeArrayOrString = errors.New("step command must be an array of strings or a string") ErrTimeoutSecMustBeNonNegative = errors.New("timeout_sec must be >= 0") ErrExecutorDoesNotSupportMultipleCmd = errors.New("action does not support multiple commands") )
var ( ErrNameOrPathRequired = errors.New("name or path is required") ErrInvalidJSONFile = errors.New("invalid JSON file") )
Errors for loading DAGs
Functions ¶
func BuiltinActionNames ¶
func BuiltinActionNames() []string
BuiltinActionNames returns the currently accepted built-in action names in sorted order. Redis operations are intentionally exposed as a pattern because they normalize dynamically from any redis.<operation> action.
func DeprecatedSyntaxWarnings ¶
DeprecatedSyntaxWarnings returns validate-only deprecation warnings for legacy DAG syntax. Runtime loading intentionally does not call this function.
func IsValidExecutorTypeName ¶
IsValidExecutorTypeName reports whether name is valid for an executor type.
func Load ¶
Load loads a Directed Acyclic Graph (core.DAG) from a file path or name with the given options.
The function handles different input formats:
1. Absolute paths:
- YAML files (.yaml/.yml): Processed with dynamic evaluation, including base configs, parameters, and environment variables
2. Relative paths or filenames:
- Resolved against the DAGsDir specified in options
- If DAGsDir is not provided, the current working directory is used
- For YAML files, the extension is optional
This approach provides a flexible way to load core.DAG definitions from multiple sources while supporting customization through the LoadOptions.
func LoadBaseConfig ¶
func LoadBaseConfig(ctx BuildContext, file string) (*core.DAG, error)
LoadBaseConfig loads the global configuration from the given file. The global configuration can be overridden by the core.DAG configuration.
func LoadYAMLWithOpts ¶
LoadYAMLWithOpts loads the core.DAG configuration from YAML data.
func QuoteRuntimeParams ¶
QuoteRuntimeParams quotes persisted params so values containing spaces survive re-parsing when a DAG is rebuilt from status metadata.
func RegisterExecutorTypeName ¶
func RegisterExecutorTypeName(name string)
RegisterExecutorTypeName registers a runtime executor type name so DAG loading accepts steps that use it directly in the type field.
func ResolveEnv ¶
func ResolveEnv(ctx context.Context, dag *core.DAG, params any, opts ResolveEnvOptions) ([]string, error)
ResolveEnv rebuilds the DAG env from source when the current DAG snapshot no longer carries resolved env entries (for example when restored from dag.json).
func ResolveRuntimeParams ¶
func ResolveRuntimeParams(ctx context.Context, dag *core.DAG, params any, opts ResolveRuntimeParamsOptions) (*core.DAG, error)
ResolveRuntimeParams reloads a DAG from its source with runtime params applied. It is intended for entry points that need the same coercion and validation path as execution without duplicating loader setup.
func StepTypeNames ¶
func StepTypeNames() []string
StepTypeNames returns the currently accepted builtin and runtime-registered executor type names in sorted order. It excludes the implicit empty command executor type; callers should mention omitted type handling separately.
func TypedUnionDecodeHook ¶
func TypedUnionDecodeHook() mapstructure.DecodeHookFunc
TypedUnionDecodeHook returns a decode hook that handles our typed union types. It converts raw map[string]any values to the appropriate typed values.
func UnregisterExecutorTypeName ¶
func UnregisterExecutorTypeName(name string)
UnregisterExecutorTypeName removes a runtime executor type name that was registered by RegisterExecutorTypeName. Built-in names are retained.
Types ¶
type BuildContext ¶
type BuildContext struct {
// contains filtered or unexported fields
}
BuildContext is the context for building a DAG.
func (BuildContext) WithCustomStepTypes ¶
func (c BuildContext) WithCustomStepTypes(registry *customStepTypeRegistry) BuildContext
func (BuildContext) WithFile ¶
func (c BuildContext) WithFile(file string) BuildContext
func (BuildContext) WithOpts ¶
func (c BuildContext) WithOpts(opts BuildOpts) BuildContext
type BuildFlag ¶
type BuildFlag uint32
BuildFlag represents a bitmask option that influences DAG building behaviour.
const ( BuildFlagNone BuildFlag = 0 BuildFlagNoEval BuildFlag = 1 << iota BuildFlagOnlyMetadata BuildFlagAllowBuildErrors BuildFlagSkipSchemaValidation BuildFlagSkipBaseHandlers // Skip merging handlerOn from base config (for sub-DAG runs) BuildFlagValidateRuntimeParams BuildFlagDeferWorkerSelector )
type BuildOpts ¶
type BuildOpts struct {
// Base specifies the Base configuration file for the DAG.
Base string
// BaseConfigContent is the raw base config YAML content.
// When set, this takes precedence over Base file path.
BaseConfigContent []byte
// WorkspaceBaseConfigDir contains per-workspace base configs at <workspace>/base.yaml.
WorkspaceBaseConfigDir string
// Parameters specifies the Parameters to the DAG.
// Parameters are used to override the default Parameters in the DAG.
Parameters string
// ParametersList specifies the parameters to the DAG.
ParametersList []string
// Name of the core.DAG if it's not defined in the spec
Name string
// DAGsDir is the directory containing the core.DAG files.
DAGsDir string
// DefaultWorkingDir is the default working directory for DAGs without explicit workingDir.
DefaultWorkingDir string
// SourceFile is the path the DAG was authored at. It is set when the
// definition is loaded from a copy, so relative paths keep resolving
// against the file the author wrote rather than the copy.
SourceFile string
// Flags stores all boolean options controlling build behaviour.
Flags BuildFlag
// BuildEnv provides pre-populated environment variables for the build.
// These are added to envScope before building, allowing YAML to reference
// them via ${VAR}. Used for retry/restart where dotenv values need to be
// available during rebuild from YamlData.
BuildEnv map[string]string
}
BuildOpts is used to control the behavior of the builder.
type CustomActionEditorHint ¶
type CustomActionEditorHint struct {
Name string
Description string
InputSchema map[string]any
OutputSchema map[string]any
}
CustomActionEditorHint is editor-only metadata for a custom action. It is derived from the same validated spec pipeline as runtime expansion.
func InheritedCustomActionEditorHints ¶
func InheritedCustomActionEditorHints(baseConfig []byte) ([]CustomActionEditorHint, error)
InheritedCustomActionEditorHints returns editor hints for custom actions declared in base config. The returned schemas are fully resolved JSON Schema objects safe to embed into editor-generated DAG schemas.
type HumanTaskInputResult ¶
type HumanTaskInputResult struct {
Canonical json.RawMessage
Outputs map[string]string
}
HumanTaskInputResult contains canonical form input and its step outputs.
func ValidateHumanTaskInputs ¶
func ValidateHumanTaskInputs(form json.RawMessage, inputs map[string]any, coerceStrings bool) (*HumanTaskInputResult, error)
ValidateHumanTaskInputs applies form defaults and validates completion input.
type LegacyDefinitionEditorHint ¶
type LegacyDefinitionEditorHint struct {
Name string
TargetType string
Description string
InputSchema map[string]any
OutputSchema map[string]any
}
LegacyDefinitionEditorHint is editor-only metadata for a deprecated step_types entry. It is derived from the same validated spec pipeline as runtime expansion.
func InheritedLegacyDefinitionEditorHints ¶
func InheritedLegacyDefinitionEditorHints(baseConfig []byte) ([]LegacyDefinitionEditorHint, error)
InheritedLegacyDefinitionEditorHints returns editor hints for deprecated step_types declared in base config. The returned schemas are fully resolved JSON Schema objects safe to embed into editor-generated DAG schemas.
type LoadOption ¶
type LoadOption func(*LoadOptions)
LoadOption is a function type for setting LoadOptions.
func OnlyMetadata ¶
func OnlyMetadata() LoadOption
OnlyMetadata sets the flag to load only metadata.
func SkipSchemaValidation ¶
func SkipSchemaValidation() LoadOption
SkipSchemaValidation disables schema resolution/validation during build.
func WithAllowBuildErrors ¶
func WithAllowBuildErrors() LoadOption
WithAllowBuildErrors allows build errors to be ignored during core.DAG loading. This is required for loading DAGs that may have errors in their definitions, such as missing steps or invalid configurations. When this option is set, the loader will return a core.DAG with the errors included in the DAG's `BuildErrors` field, and will not fail the loading process.
func WithBaseConfig ¶
func WithBaseConfig(baseDAG string) LoadOption
WithBaseConfig sets the base core.DAG configuration file.
func WithBaseConfigContent ¶
func WithBaseConfigContent(content []byte) LoadOption
WithBaseConfigContent sets the raw base config YAML content directly. This is used in distributed mode where workers may not have local base config files. When set, this takes precedence over the base config file path.
func WithBuildEnv ¶
func WithBuildEnv(env map[string]string) LoadOption
WithBuildEnv provides additional environment variables for the build. These are added to the envScope before building, allowing YAML to reference them via ${VAR}. This is used for retry scenarios where dotenv values need to be available during rebuild from YamlData.
func WithDAGsDir ¶
func WithDAGsDir(dagsDir string) LoadOption
WithDAGsDir sets the directory containing the core.DAG files. This directory is used as the base path for resolving relative core.DAG file paths. When a core.DAG is loaded by name rather than absolute path, the system will look for the core.DAG file in this directory. If not specified, the current working directory is used as the default.
func WithDefaultWorkingDir ¶
func WithDefaultWorkingDir(defaultWorkingDir string) LoadOption
WithDefaultWorkingDir sets the default working directory for DAGs without explicit workingDir.
func WithParams ¶
func WithParams(params any) LoadOption
WithParams sets the parameters for the DAG.
func WithSkipBaseHandlers ¶
func WithSkipBaseHandlers() LoadOption
WithSkipBaseHandlers skips merging handlerOn from base config. This is used for sub-DAG runs to prevent handler inheritance from base config. Sub-DAGs should have their own handlers defined explicitly if needed.
func WithSourceFile ¶
func WithSourceFile(sourceFile string) LoadOption
WithSourceFile sets the path the DAG was authored at. A definition executed from a temporary copy, such as a sub-workflow or a task dispatched to a worker, resolves its relative paths against this rather than against the copy.
func WithWorkspaceBaseConfigDir ¶
func WithWorkspaceBaseConfigDir(dir string) LoadOption
WithWorkspaceBaseConfigDir sets the directory containing workspace base configs. Named workspace DAGs inherit <dir>/<workspace>/base.yaml after the global base config.
func WithoutEval ¶
func WithoutEval() LoadOption
WithoutEval disables the evaluation of dynamic fields.
type LoadOptions ¶
type LoadOptions struct {
// contains filtered or unexported fields
}
LoadOptions contains options for loading a DAG.
type LoadResult ¶
type LoadResult struct {
DAG *core.DAG
ValueReferenceNotices []cmnvalue.ValueReferenceNotice
}
LoadResult contains a loaded DAG and transient value-reference notices produced by that load operation.
func LoadWithResult ¶
func LoadWithResult(ctx context.Context, nameOrPath string, opts ...LoadOption) (*LoadResult, error)
LoadWithResult loads a DAG and returns transient value-reference notices produced by that load operation.
func LoadYAMLWithResult ¶
func LoadYAMLWithResult(ctx context.Context, data []byte, opts ...LoadOption) (*LoadResult, error)
LoadYAMLWithResult loads a DAG from YAML and returns transient value-reference notices produced by that load operation.
type ResolveEnvOptions ¶
ResolveEnvOptions controls how a DAG is reloaded to recover resolved env values for subprocess launchers.
type ResolveEnvResult ¶
ResolveEnvResult contains resolved env entries and warnings encountered while rebuilding them.
func ResolveEnvWithWarnings ¶
func ResolveEnvWithWarnings(ctx context.Context, dag *core.DAG, params any, opts ResolveEnvOptions) (ResolveEnvResult, error)
ResolveEnvWithWarnings rebuilds the DAG env and returns warnings emitted during dotenv loading.
type ResolveRuntimeParamsOptions ¶
ResolveRuntimeParamsOptions controls how a DAG is reloaded for runtime param validation.
type StepBuildContext ¶
type StepBuildContext struct {
BuildContext
// contains filtered or unexported fields
}
StepBuildContext is the context for building a step.
Source Files
¶
- builder.go
- consts.go
- controller.go
- dag.go
- dag_param_schema.go
- defaults.go
- deprecation.go
- dparams.go
- dparams_external_schema.go
- dparams_inline.go
- dparams_inline_schema.go
- dparams_runtime.go
- editor_hints.go
- errors.go
- human_task.go
- human_task_form.go
- key_hints.go
- kubernetes.go
- loader.go
- manifest_decoder.go
- params.go
- runtime_env.go
- schema.go
- step.go
- step_types.go
- step_v2.go
- tools_yaml.go
- value_reference_notices.go
- variables.go