3c1061fbd8
DagContinueOn gana el campo ExitCodes []int (codigos de salida tolerados) y el parser mapea continue_on.exit_code desde el YAML. retry_policy (limit, interval_sec) ya existia en el modelo y ahora queda documentado como contrato estable para los executors. Funcion pura: solo normaliza el YAML al modelo DagDefinition; la interpretacion (reintentar, tolerar codigos) vive en el executor que lo consuma (dag_engine). Test: 'parsea continue_on.exit_code y retry_policy'. Tag de grupo: scheduler.
72 lines
1.9 KiB
Go
72 lines
1.9 KiB
Go
package core
|
|
|
|
// DagContinueOn controls whether a step continues on failure/skip.
|
|
type DagContinueOn struct {
|
|
Failure bool
|
|
Skipped bool
|
|
// ExitCodes lists exit codes that are tolerated: if the step exits with one
|
|
// of these non-zero codes, it is treated as a non-failure (the DAG keeps
|
|
// going and the run is not marked failed). The real exit code is still
|
|
// recorded. Empty means only exit 0 is a success (unless Failure is set).
|
|
ExitCodes []int
|
|
}
|
|
|
|
// DagRetryPolicy configures automatic retries for a step.
|
|
type DagRetryPolicy struct {
|
|
Limit int
|
|
IntervalSec int
|
|
}
|
|
|
|
// DagStep represents a single step in a DAG workflow.
|
|
type DagStep struct {
|
|
Name string
|
|
ID string
|
|
Description string
|
|
Command string
|
|
Script string
|
|
Args []string
|
|
Function string `json:"function,omitempty"` // ID de funcion del registry (ej "audit_capability_groups_go_infra"). Si set, Command/Script se ignoran; el executor construye "fn run <Function> <Args...>".
|
|
Shell string
|
|
Dir string
|
|
Depends []string
|
|
Env map[string]string
|
|
ContinueOn DagContinueOn
|
|
RetryPolicy DagRetryPolicy
|
|
TimeoutSec int
|
|
Output string
|
|
Tags []string
|
|
}
|
|
|
|
// DagHandlers contains lifecycle handler steps.
|
|
type DagHandlers struct {
|
|
Init []DagStep
|
|
Success []DagStep
|
|
Failure []DagStep
|
|
Exit []DagStep
|
|
}
|
|
|
|
// DagDefinition is a complete DAG workflow parsed from YAML.
|
|
type DagDefinition struct {
|
|
Name string
|
|
Description string
|
|
Group string
|
|
Type string // "graph" or "" (chain/sequential)
|
|
WorkingDir string
|
|
Shell string
|
|
Env map[string]string
|
|
Schedule []string
|
|
Steps []DagStep
|
|
HandlerOn DagHandlers
|
|
Tags []string
|
|
TimeoutSec int
|
|
FilePath string
|
|
}
|
|
|
|
// DagValidationResult contains validation output.
|
|
type DagValidationResult struct {
|
|
Valid bool
|
|
Errors []string
|
|
Warnings []string
|
|
Levels [][]string // topological levels (step names/IDs)
|
|
}
|