runtasksconcurrent

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 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.

Configuration Parameters

  • succeedTaskCount:
    The minimum number of child tasks that need to complete with a "success" result for the run_tasks_concurrent task to stop and return a success result. A value of 0 indicates that all child tasks need to succeed for the overall task to be considered successful.

  • failTaskCount:
    The minimum number of child tasks that need to complete with a "failure" result for the run_tasks_concurrent task to stop and return a failure result. A value of 1 means the overall task will fail as soon as one child task fails.

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

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

Defaults

Default settings for the run_tasks_concurrent task:

- name: run_tasks_concurrent
  config:
    succeedTaskCount: 0
    failTaskCount: 1
    newVariableScope: true
    tasks: []

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.",
		Config:      DefaultConfig(),
		NewTask:     NewTask,
	}
)

Functions

func NewTask

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

Types

type Config

type Config struct {
	// number of successful child tasks to make this task succeed (0 = all tasks)
	SucceedTaskCount uint64 `yaml:"succeedTaskCount" json:"succeedTaskCount"`

	// number of failed child tasks to make this task fail (0 = all tasks)
	FailTaskCount uint64 `yaml:"failTaskCount" json:"failTaskCount"`

	// create a new variable scope for the child tasks
	NewVariableScope bool `yaml:"newVariableScope" json:"newVariableScope"`

	// child tasks
	Tasks []helper.RawMessageMasked `yaml:"tasks" json:"tasks"`
}

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