runtasksconcurrent

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: GPL-3.0 Imports: 8 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.

  • 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
    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"`

	// child tasks
	Tasks []helper.RawMessage `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) Description

func (t *Task) Description() string

func (*Task) Execute

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

func (*Task) LoadConfig

func (t *Task) LoadConfig() error

func (*Task) Logger

func (t *Task) Logger() logrus.FieldLogger

func (*Task) Name

func (t *Task) Name() string

func (*Task) Timeout

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

func (*Task) Title

func (t *Task) Title() string

Jump to

Keyboard shortcuts

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