runtasksconcurrent

package
v0.1.1 Latest Latest
Warning

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

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

README

run_tasks_concurrent Task

Description

The run_tasks_concurrent task allows for the parallel execution of multiple tasks. This task is crucial in scenarios where tasks need to be run simultaneously, such as in testing environments that require concurrent processes or operations.

Task Behavior
  • All child tasks are started concurrently.
  • By default, the task waits for all children to complete.
  • The result is failure if any child task fails, success if all succeed.
  • Use stopOnThreshold to cancel remaining tasks when success/failure threshold is reached.

Configuration Parameters

  • tasks:
    An array of child tasks to be executed concurrently. Each task in this array should be defined according to the standard task structure.

  • successThreshold:
    The minimum number of child tasks that need to complete with a "success" result for the task to be considered successful. A value of 0 (default) means all child tasks must succeed.

  • failureThreshold:
    The number of child tasks that need to fail before the task is considered failed. Default: 1 (any single failure causes overall failure).

  • stopOnThreshold:
    If set to true, remaining child tasks are cancelled when either the success or failure threshold is reached. If false (default), the task waits for all children to complete before determining the result.

  • invertResult:
    If set to true, the final result is inverted: success becomes failure and failure becomes success. Default: false.

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

  • newVariableScope:
    If set to true, a new variable scope will be created for each child task. If false, the child tasks will use the same variable scope as the parent task. Default: true.

Defaults

Default settings for the run_tasks_concurrent task:

- name: run_tasks_concurrent
  config:
    tasks: []
    successThreshold: 0
    failureThreshold: 1
    stopOnThreshold: false
    invertResult: false
    ignoreResult: false
    newVariableScope: true

Outputs

This task does not produce any outputs.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "run_tasks_concurrent"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Runs multiple tasks in parallel.",
		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 concurrently."`
	NewVariableScope bool                      `yaml:"newVariableScope" json:"newVariableScope" desc:"If true, create a new variable scope for child tasks."`

	// Threshold behavior:
	// - 0 (default): No threshold - only evaluate result when ALL tasks complete
	// - >0: Set result when threshold is reached (but continue until all complete unless StopOnThreshold=true)
	SuccessThreshold uint64 `` /* 136-byte string literal not displayed */
	FailureThreshold uint64 `` /* 126-byte string literal not displayed */

	// Early termination - if true, stop immediately when a threshold is reached
	// Default: false - always wait for all tasks to complete
	StopOnThreshold bool `` /* 140-byte string literal not displayed */

	// 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