taskflow

package module
v0.0.0-...-dc813ae Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

README

taskflow

        graph TD
        second --> |SUCCESS|finish
        second --> |FAILURE|failure
        second --> |JUMP2|jump
        failure --> |JUMP3|jump
        failure --> |SUCCESS|finish
        jump --> |SUCCESS|finish
        first --> |SUCCESS|second
        first --> |FAILURE|failure
        first --> |JUMP1|jump
        style finish fill:#f9f

Documentation

Index

Constants

View Source
const (
	StepCodeFailure = "FAILURE"

	StepCodeSuccess = "SUCCESS"

	StepCodeJump1 = "JUMP1"
	StepCodeJump2 = "JUMP2"
	StepCodeJump3 = "JUMP3"

	LogFieldKeyStepKey = "StepKey"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GraphConfig

type GraphConfig struct {
	FinishStepKey string

	StartStyleColor   string
	FinishStyleColor  string
	RunStepStyleColor string
}

type RunStep

type RunStep struct {
	StepKey  string
	StepCode string
}

type Runner

type Runner struct {
	GraphConfig *GraphConfig
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(logger golog.Logger) *Runner

func (*Runner) RunTask

func (r *Runner) RunTask(task Task, in, out interface{}) error

func (*Runner) TaskGraph

func (r *Runner) TaskGraph(task Task, showCodes ...string) string

func (*Runner) TaskGraphRunSteps

func (r *Runner) TaskGraphRunSteps(task Task, runSteps []*RunStep, showCodes ...string) string

func (*Runner) TaskGraphRunStepsFromJson

func (r *Runner) TaskGraphRunStepsFromJson(task Task, runStepsJson []byte, showCodes ...string) (string, error)

func (*Runner) TaskRunSteps

func (r *Runner) TaskRunSteps() []*RunStep

type StepConfig

type StepConfig struct {
	RetryCnt   int
	RetryDelay time.Duration

	StepFunc       StepFunc
	StepFailedFunc StepFailedFunc
	RouteMap       map[string]string
}

type StepFailedFunc

type StepFailedFunc func(stepKey string, err error)

type StepFunc

type StepFunc func() (string, error)

type Task

type Task interface {
	Name() string

	Init(in, out interface{}) error

	StepConfigMap() map[string]*StepConfig
	FirstStepKey() string

	BeforeStep(stepKey string)
	AfterStep(stepKey string)

	Error() error
}

Jump to

Keyboard shortcuts

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