runtaskmatrix

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_task_matrix Task

Description

The run_task_matrix task is designed to execute a specified task multiple times, each with different input values drawn from an array. This task is ideal for scenarios where you need to test a task under various conditions or with different sets of data.

Configuration Parameters

  • runConcurrent:
    Determines whether the child tasks (instances of the task being run for each matrix value) should run concurrently or sequentially. If true, all tasks run at the same time; if false, they run one after the other.

  • succeedTaskCount:
    The number of child tasks that need to succeed (result status "success") for the run_task_matrix task to stop and return a success result. A value of 0 means all child tasks need to succeed for the overall task to be considered successful.

  • failTaskCount:
    The number of child tasks that may to fail (result status "failure") before the run_task_matrix task to stops and returns a failure result. A value of 0 means that the appearance of any failure in child tasks will cause the overall task to fail.

  • matrixValues:
    An array of values that form the matrix. Each value in this array is used to run the child task with a different input.

  • matrixVar:
    The name of the variable to which the current matrix value is assigned for each child task. This allows the child task to access and use the specific value from the matrix.

  • task:
    The definition of the task to be executed for each matrix value. This task is run repeatedly, once for each value in the matrixValues array, with the current value made accessible via the variable named in matrixVar.

Defaults

Default settings for the run_task_matrix task:

- name: run_task_matrix
  config:
    runConcurrent: false
    succeedTaskCount: 0
    failTaskCount: 0
    matrixValues: []
    matrixVar: ""
    task: {}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "run_task_matrix"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Run a task multiple times based on an input array.",
		Config:      DefaultConfig(),
		NewTask:     NewTask,
	}
)

Functions

func NewTask

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

Types

type Config

type Config struct {
	// matrix variable name
	RunConcurrent bool `yaml:"runConcurrent" json:"runConcurrent"`

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

	// matrix variable name
	MatrixValues []interface{} `yaml:"matrixValues" json:"matrixValues"`

	// matrix variable name
	MatrixVar string `yaml:"matrixVar" json:"matrixVar"`

	// child task
	Task *helper.RawMessage `yaml:"task" json:"task"`
}

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