dag

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExecutorTypeSubWorkflow = "subworkflow"
)

Variables

View Source
var EXTENSIONS = []string{".yaml", ".yml"}

Functions

func EvalCondition

func EvalCondition(c *Condition) error

EvalCondition evaluates a single condition and checks the result.

func EvalConditions

func EvalConditions(cond []*Condition) error

EvalConditions evaluates a list of conditions and checks the results.

func NewContext

func NewContext(ctx context.Context, dag *DAG, finder DAGFinder) context.Context

NewContext sets the current DAG to the context.

func ReadFile

func ReadFile(file string) (string, error)

Types

type BuildDAGOptions

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

type Condition

type Condition struct {
	Condition string
	Expected  string
}

Condition represents a condition to be evaluated by the agent.

func (*Condition) CheckResult

func (c *Condition) CheckResult(actualValue string) error

CheckResult checks if the actual value of the condition matches the expected value.

func (*Condition) Evaluate

func (c *Condition) Evaluate() (string, error)

Evaluate returns the actual value of the condition.

type Context added in v1.13.0

type Context struct {
	DAG    *DAG
	Finder DAGFinder
}

func GetContext added in v1.13.0

func GetContext(ctx context.Context) (Context, error)

GetContext returns the DAG from the current context.

type ContinueOn

type ContinueOn struct {
	Failure bool
	Skipped bool
}

ContinueOn represents the conditions under which the step continues.

type DAG

type DAG struct {
	Location          string
	Group             string
	Name              string
	Schedule          []*Schedule
	StopSchedule      []*Schedule
	RestartSchedule   []*Schedule
	Description       string
	Env               []string
	LogDir            string
	HandlerOn         HandlerOn
	Steps             []Step
	MailOn            *MailOn
	ErrorMail         *MailConfig
	InfoMail          *MailConfig
	Smtp              *SmtpConfig
	Delay             time.Duration
	RestartWait       time.Duration
	HistRetentionDays int
	Preconditions     []*Condition
	MaxActiveRuns     int
	Params            []string
	DefaultParams     string
	MaxCleanUpTime    time.Duration
	Tags              []string
}

DAG represents a DAG configuration.

func (*DAG) Clone

func (d *DAG) Clone() *DAG

func (*DAG) HasTag

func (d *DAG) HasTag(tag string) bool

func (*DAG) SockAddr

func (d *DAG) SockAddr() string

func (*DAG) String

func (d *DAG) String() string

type DAGBuilder

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

type DAGFinder added in v1.13.0

type DAGFinder interface {
	FindByName(name string) (*DAG, error)
}

DAGFinder is an interface for finding a DAG by name.

type ExecutorConfig

type ExecutorConfig struct {
	Type   string
	Config map[string]interface{}
}

ExecutorConfig represents the configuration for the executor of a step.

type HandlerOn

type HandlerOn struct {
	Failure *Step
	Success *Step
	Cancel  *Step
	Exit    *Step
}

type Loader

type Loader struct {
	BaseConfig string
}

Loader is a config loader.

func (*Loader) Load

func (cl *Loader) Load(f, params string) (*DAG, error)

Load loads config from file.

func (*Loader) LoadData

func (cl *Loader) LoadData(data []byte) (*DAG, error)

LoadData loads config from given data.

func (*Loader) LoadMetadata

func (cl *Loader) LoadMetadata(f string) (*DAG, error)

LoadMetadata loads config from file and returns only the headline data.

func (*Loader) LoadWithoutEval

func (cl *Loader) LoadWithoutEval(f string) (*DAG, error)

LoadWithoutEval loads config from file without evaluating env variables.

type MailConfig

type MailConfig struct {
	From       string
	To         string
	Prefix     string
	AttachLogs bool
}

type MailOn

type MailOn struct {
	Failure bool
	Success bool
}

type RepeatPolicy

type RepeatPolicy struct {
	Repeat   bool
	Interval time.Duration
}

RepeatPolicy represents the repeat policy for a step.

type RetryPolicy

type RetryPolicy struct {
	Limit    int
	Interval time.Duration
}

RetryPolicy represents the retry policy for a step.

type Schedule

type Schedule struct {
	Expression string
	Parsed     cron.Schedule
}

type SmtpConfig

type SmtpConfig struct {
	Host     string
	Port     string
	Username string
	Password string
}

type Step

type Step struct {
	Name            string         `json:"Name"`
	Description     string         `json:"Description,omitempty"`
	Variables       []string       `json:"Variables,omitempty"`
	OutputVariables *utils.SyncMap `json:"OutputVariables,omitempty"`
	Dir             string         `json:"Dir,omitempty"`
	ExecutorConfig  ExecutorConfig `json:"ExecutorConfig,omitempty"`
	CmdWithArgs     string         `json:"CmdWithArgs,omitempty"`
	Command         string         `json:"Command,omitempty"`
	Script          string         `json:"Script,omitempty"`
	Stdout          string         `json:"Stdout,omitempty"`
	Stderr          string         `json:"Stderr,omitempty"`
	Output          string         `json:"Output,omitempty"`
	Args            []string       `json:"Args,omitempty"`
	Depends         []string       `json:"Depends,omitempty"`
	ContinueOn      ContinueOn     `json:"ContinueOn,omitempty"`
	RetryPolicy     *RetryPolicy   `json:"RetryPolicy,omitempty"`
	RepeatPolicy    RepeatPolicy   `json:"RepeatPolicy,omitempty"`
	MailOnError     bool           `json:"MailOnError,omitempty"`
	Preconditions   []*Condition   `json:"Preconditions,omitempty"`
	SignalOnStop    string         `json:"SignalOnStop,omitempty"`
	SubWorkflow     *SubWorkflow   `json:"SubWorkflow,omitempty"`
}

Step represents a step in a DAG.

func (*Step) String

func (s *Step) String() string

String returns a string representation of the step's properties.

type SubWorkflow added in v1.13.0

type SubWorkflow struct {
	Name   string
	Params string
}

Jump to

Keyboard shortcuts

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