runtasks

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

README

run_tasks Task

Description

The run_tasks task executes a series of specified tasks sequentially. This is particularly useful for scenarios where tasks need to be performed in a specific order, with the outcome of one potentially affecting the subsequent ones.

Task Behavior
  • The task starts the child tasks one after the other in the order they are listed.
  • Each child task runs until it completes naturally (returns success or failure).
  • After a child task completes, the run_tasks task initiates the next task in the sequence.
  • By default, the sequence stops if any child task fails. Use continueOnFailure to continue despite failures.

Configuration Parameters

  • tasks:
    An array of tasks to be executed one after the other. Each task is defined according to the standard task structure.

  • continueOnFailure:
    When true, the sequence of tasks continues even if individual tasks fail, allowing the entire sequence to be executed regardless of individual task outcomes. Default: false.

  • invertResult:
    If set to true, the final result is inverted: success becomes failure and failure becomes success. Useful when you expect all tasks to fail. Default: false.

  • ignoreResult:
    If set to true, the task always returns success regardless of child task outcomes. Default: false.

  • newVariableScope:
    Determines whether to create a new variable scope for the child tasks. If false, the current scope is passed through, allowing the child tasks to share the same variable context as the run_tasks task. Default: false.

Defaults

Default settings for the run_tasks task:

- name: run_tasks
  config:
    tasks: []
    continueOnFailure: false
    invertResult: false
    ignoreResult: false
    newVariableScope: false

Outputs

This task does not produce any outputs.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "run_tasks"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Run tasks sequentially.",
		Category:    "flow-control",
		Config:      DefaultConfig(),
		Outputs:     []types.TaskOutputDefinition{},
		NewTask:     NewTask,
	}
)

Functions

func NewTask

func NewTask(ctx *types.TaskContext, options *types.TaskOptions) (types.Task, error)

Types

type Config

type Config struct {
	Tasks            []helper.RawMessageMasked `yaml:"tasks" json:"tasks" require:"A" desc:"List of tasks to execute sequentially."`
	NewVariableScope bool                      `yaml:"newVariableScope" json:"newVariableScope" desc:"If true, create a new variable scope for child tasks."`

	// Failure handling (default: stop on first failure)
	ContinueOnFailure bool `yaml:"continueOnFailure" json:"continueOnFailure" desc:"If true, continue executing remaining tasks even if one fails."`

	// Result transformation
	InvertResult bool `yaml:"invertResult" json:"invertResult" desc:"If true, swap success and failure results."`
	IgnoreResult bool `yaml:"ignoreResult" json:"ignoreResult" desc:"If true, always report success regardless of child task results."`
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) Validate

func (c *Config) Validate() error

type Task

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

func (*Task) Config

func (t *Task) Config() interface{}

func (*Task) Execute

func (t *Task) Execute(ctx context.Context) error

func (*Task) LoadConfig

func (t *Task) LoadConfig() error

func (*Task) Timeout

func (t *Task) Timeout() time.Duration

Jump to

Keyboard shortcuts

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