Documentation
¶
Index ¶
- Constants
- Variables
- func IsBuiltinWorkflowStepType(wfType string) bool
- func IsStepFinish(phase common.WorkflowStepPhase, reason string) bool
- type Action
- type Engine
- type GeneratorOptions
- type Operation
- type PreCheckOptions
- type PreCheckResult
- type TaskDiscover
- type TaskGenerator
- type TaskPostStopHook
- type TaskPreCheckHook
- type TaskPreStartHook
- type TaskRunOptions
- type TaskRunner
Constants ¶
View Source
const ( // ContextKeyMetadata is key that refer to application metadata. ContextKeyMetadata = "metadata__" // ContextPrefixFailedTimes is the prefix that refer to the failed times of the step in workflow context config map. ContextPrefixFailedTimes = "failed_times" // ContextPrefixBackoffTimes is the prefix that refer to the backoff times in workflow context config map. ContextPrefixBackoffTimes = "backoff_times" // ContextPrefixBackoffReason is the prefix that refer to the current backoff reason in workflow context config map ContextPrefixBackoffReason = "backoff_reason" // ContextKeyLastExecuteTime is the key that refer to the last execute time in workflow context config map. ContextKeyLastExecuteTime = "last_execute_time" // ContextKeyNextExecuteTime is the key that refer to the next execute time in workflow context config map. ContextKeyNextExecuteTime = "next_execute_time" )
View Source
const ( // WorkflowStepTypeSuspend type suspend WorkflowStepTypeSuspend = "suspend" // WorkflowStepTypeApplyComponent type apply-component WorkflowStepTypeApplyComponent = "apply-component" // WorkflowStepTypeBuiltinApplyComponent type builtin-apply-component WorkflowStepTypeBuiltinApplyComponent = "builtin-apply-component" // WorkflowStepTypeStepGroup type step-group WorkflowStepTypeStepGroup = "step-group" )
View Source
const ( // StatusReasonWait is the reason of the workflow progress condition which is Wait. StatusReasonWait = "Wait" // StatusReasonSkip is the reason of the workflow progress condition which is Skip. StatusReasonSkip = "Skip" // StatusReasonRendering is the reason of the workflow progress condition which is Rendering. StatusReasonRendering = "Rendering" // StatusReasonExecute is the reason of the workflow progress condition which is Execute. StatusReasonExecute = "Execute" // StatusReasonSuspend is the reason of the workflow progress condition which is Suspend. StatusReasonSuspend = "Suspend" // StatusReasonTerminate is the reason of the workflow progress condition which is Terminate. StatusReasonTerminate = "Terminate" // StatusReasonParameter is the reason of the workflow progress condition which is ProcessParameter. StatusReasonParameter = "ProcessParameter" // StatusReasonOutput is the reason of the workflow progress condition which is Output. StatusReasonOutput = "Output" // StatusReasonFailedAfterRetries is the reason of the workflow progress condition which is FailedAfterRetries. StatusReasonFailedAfterRetries = "FailedAfterRetries" // StatusReasonTimeout is the reason of the workflow progress condition which is Timeout. StatusReasonTimeout = "Timeout" // StatusReasonAction is the reason of the workflow progress condition which is Action. StatusReasonAction = "Action" )
Variables ¶
View Source
var ( // MaxWorkflowStepErrorRetryTimes is the max retry times of the failed workflow step. MaxWorkflowStepErrorRetryTimes = 10 // MaxWorkflowWaitBackoffTime is the max time to wait before reconcile wait workflow again MaxWorkflowWaitBackoffTime = 60 // MaxWorkflowFailedBackoffTime is the max time to wait before reconcile failed workflow again MaxWorkflowFailedBackoffTime = 300 )
Functions ¶
func IsBuiltinWorkflowStepType ¶ added in v1.3.0
IsBuiltinWorkflowStepType checks if workflow step type is builtin type
func IsStepFinish ¶ added in v1.5.0
func IsStepFinish(phase common.WorkflowStepPhase, reason string) bool
IsStepFinish will decide whether step is finish.
Types ¶
type Action ¶
type Action interface {
Suspend(message string)
Terminate(message string)
Wait(message string)
Fail(message string)
}
Action is that workflow provider can do.
type Engine ¶ added in v1.4.0
type Engine interface {
Run(taskRunners []TaskRunner, dag bool) error
GetStepStatus(stepName string) common.WorkflowStepStatus
GetCommonStepStatus(stepName string) common.StepStatus
SetParentRunner(name string)
GetOperation() *Operation
}
Engine is the engine to run workflow
type GeneratorOptions ¶ added in v1.1.1
type GeneratorOptions struct {
ID string
PrePhase common.WorkflowStepPhase
StepConvertor func(step v1beta1.WorkflowStep) (v1beta1.WorkflowStep, error)
SubTaskRunners []TaskRunner
PackageDiscover *packages.PackageDiscover
ProcessContext process.Context
ExecuteMode common.WorkflowMode
}
GeneratorOptions is the options for generate task.
type Operation ¶
type Operation struct {
Suspend bool
Terminated bool
Waiting bool
Skip bool
FailedAfterRetries bool
}
Operation is workflow operation object.
type PreCheckOptions ¶ added in v1.5.0
type PreCheckOptions struct {
PackageDiscover *packages.PackageDiscover
ProcessContext process.Context
}
PreCheckOptions is the options for pre check.
type PreCheckResult ¶ added in v1.5.0
PreCheckResult is the result of pre check.
type TaskDiscover ¶
type TaskDiscover interface {
GetTaskGenerator(ctx context.Context, name string) (TaskGenerator, error)
}
TaskDiscover is the interface to obtain the TaskGenerator。
type TaskGenerator ¶
type TaskGenerator func(wfStep v1beta1.WorkflowStep, options *GeneratorOptions) (TaskRunner, error)
TaskGenerator will generate taskRunner.
type TaskPostStopHook ¶ added in v1.1.1
type TaskPostStopHook func(ctx wfContext.Context, taskValue *value.Value, step v1beta1.WorkflowStep, status common.StepStatus, stepStatus map[string]common.StepStatus) error
TaskPostStopHook run after task execution.
type TaskPreCheckHook ¶ added in v1.5.0
type TaskPreCheckHook func(step v1beta1.WorkflowStep, options *PreCheckOptions) (*PreCheckResult, error)
TaskPreCheckHook is the hook for pre check.
type TaskPreStartHook ¶ added in v1.1.1
type TaskPreStartHook func(ctx wfContext.Context, paramValue *value.Value, step v1beta1.WorkflowStep) error
TaskPreStartHook run before task execution.
type TaskRunOptions ¶ added in v1.1.1
type TaskRunOptions struct {
Data *value.Value
PCtx process.Context
PreCheckHooks []TaskPreCheckHook
PreStartHooks []TaskPreStartHook
PostStopHooks []TaskPostStopHook
GetTracer func(id string, step v1beta1.WorkflowStep) monitorCtx.Context
RunSteps func(isDag bool, runners ...TaskRunner) (*common.WorkflowStatus, error)
Debug func(step string, v *value.Value) error
StepStatus map[string]common.StepStatus
Engine Engine
}
TaskRunOptions is the options for task run.
type TaskRunner ¶
type TaskRunner interface {
Name() string
Pending(ctx wfContext.Context, stepStatus map[string]common.StepStatus) (bool, common.StepStatus)
Run(ctx wfContext.Context, options *TaskRunOptions) (common.StepStatus, *Operation, error)
}
TaskRunner is a task runner.
Click to show internal directories.
Click to hide internal directories.