workflow

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	Tasks []Task
	// contains filtered or unexported fields
}

Job represents a executable workflow, it has list of tasks. these tasks must be execution order. if one of these tasks throws error, the entire job will fail. During the workflow,if there are some artifacts, we can store it to runData.

func NewJob

func NewJob() *Job

NewJob return a Job with task array.

func (*Job) AppendTask

func (j *Job) AppendTask(t Task)

AppendTask append a task to job, a job has a list of task.

func (*Job) Run

func (j *Job) Run() error

Run start execte job workflow. if the task has sub task, it will recursive call the sub tasks util all of task be completed or error be thrown.

func (*Job) SetDataInitializer

func (j *Job) SetDataInitializer(build func() (RunData, error))

SetDataInitializer set a initialize runData function to job.

type RunData

type RunData = interface{}

RunData is a interface represents all of runDatas abstract object.

type Task

type Task struct {
	Name        string
	Run         func(RunData) error
	Skip        func(RunData) (bool, error)
	Tasks       []Task
	RunSubTasks bool
}

Task is minimum unit workflow. It is sample tree structrue. we can set a list of sub tasks, they will all be executed if RunSubTasks is true.

func (*Task) AppendTask

func (t *Task) AppendTask(task Task)

AppendTask append a sub task.

Jump to

Keyboard shortcuts

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