handler

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PhaseInfoUndefined = PhaseInfo{/* contains filtered or unexported fields */}

Functions

This section is empty.

Types

type BranchNodeInfo added in v0.1.13

type BranchNodeInfo struct {
}

type BranchNodeState added in v0.1.13

type BranchNodeState struct {
	FinalizedNodeID *v1alpha1.NodeID
	Phase           v1alpha1.BranchNodePhase
}

type DynamicNodeInfo added in v0.1.13

type DynamicNodeInfo struct {
}

type DynamicNodePhase added in v0.1.13

type DynamicNodePhase uint8

type DynamicNodeState added in v0.1.13

type DynamicNodeState struct {
	Phase  v1alpha1.DynamicNodePhase
	Reason string
}

type EPhase added in v0.1.13

type EPhase uint8
const (
	EPhaseUndefined EPhase = iota
	EPhaseNotReady
	EPhaseQueued
	EPhaseRunning
	EPhaseSkip
	EPhaseFailed
	EPhaseRetryableFailure
	EPhaseSuccess
	EPhaseTimedout
)

func (EPhase) IsTerminal added in v0.1.13

func (p EPhase) IsTerminal() bool

func (EPhase) String added in v0.1.13

func (p EPhase) String() string

type ExecutionInfo added in v0.1.13

type ExecutionInfo struct {
	DynamicNodeInfo  *DynamicNodeInfo
	WorkflowNodeInfo *WorkflowNodeInfo
	BranchNodeInfo   *BranchNodeInfo
	OutputInfo       *OutputInfo
	TaskNodeInfo     *TaskNodeInfo
}

type Node added in v0.1.13

type Node interface {
	// Method to indicate that finalize is required for this handler
	FinalizeRequired() bool

	// Setup should be called, before invoking any other methods of this handler in a single thread context
	Setup(ctx context.Context, setupContext SetupContext) error

	// Core method that should handle this node
	Handle(ctx context.Context, executionContext NodeExecutionContext) (Transition, error)

	// This method should be invoked to indicate the node needs to be aborted.
	Abort(ctx context.Context, executionContext NodeExecutionContext, reason string) error

	// This method is always called before completing the node, if FinalizeRequired returns true.
	// It is guaranteed that Handle -> (happens before) -> Finalize. Abort -> finalize may be repeated multiple times
	Finalize(ctx context.Context, executionContext NodeExecutionContext) error
}

Interface that should be implemented for a node type.

type NodeExecutionContext added in v0.1.13

type NodeExecutionContext interface {
	DataStore() *storage.DataStore
	InputReader() io.InputReader
	EventsRecorder() events.TaskEventRecorder
	NodeID() v1alpha1.NodeID
	Node() v1alpha1.ExecutableNode
	CurrentAttempt() uint32
	TaskReader() TaskReader

	NodeStateReader() NodeStateReader
	NodeStateWriter() NodeStateWriter

	NodeExecutionMetadata() NodeExecutionMetadata
	MaxDatasetSizeBytes() int64

	EnqueueOwnerFunc() func() error

	// Deprecated
	Workflow() v1alpha1.ExecutableWorkflow
	// TODO We should not need to pass NodeStatus, we probably only need it for DataDir, which should actually be sent using an OutputWriter interface
	// Deprecated
	NodeStatus() v1alpha1.ExecutableNodeStatus
}

type NodeExecutionMetadata added in v0.1.13

type NodeExecutionMetadata interface {
	GetOwnerID() types.NamespacedName
	// TODO we should covert this to a generic execution identifier instead of a workflow identifier
	GetExecutionID() v1alpha1.WorkflowExecutionIdentifier
	GetNamespace() string
	GetOwnerReference() v1.OwnerReference
	GetLabels() map[string]string
	GetAnnotations() map[string]string
	GetK8sServiceAccount() string
}

type NodeStateReader added in v0.1.13

type NodeStateReader interface {
	GetTaskNodeState() TaskNodeState
	GetBranchNode() BranchNodeState
	GetDynamicNodeState() DynamicNodeState
	GetWorkflowNodeState() WorkflowNodeState
}

type NodeStateWriter added in v0.1.13

type NodeStateWriter interface {
	PutTaskNodeState(s TaskNodeState) error
	PutBranchNode(s BranchNodeState) error
	PutDynamicNodeState(s DynamicNodeState) error
	PutWorkflowNodeState(s WorkflowNodeState) error
}

type OutputInfo added in v0.1.13

type OutputInfo struct {
	OutputURI storage.DataReference
}

type PhaseInfo added in v0.1.13

type PhaseInfo struct {
	// contains filtered or unexported fields
}

func PhaseInfoFailure added in v0.1.13

func PhaseInfoFailure(code, reason string, info *ExecutionInfo) PhaseInfo

func PhaseInfoFailureErr added in v0.1.13

func PhaseInfoFailureErr(err *core.ExecutionError, info *ExecutionInfo) PhaseInfo

func PhaseInfoNotReady added in v0.1.13

func PhaseInfoNotReady(reason string) PhaseInfo

func PhaseInfoQueued added in v0.1.13

func PhaseInfoQueued(reason string) PhaseInfo

func PhaseInfoRetryableFailure added in v0.1.13

func PhaseInfoRetryableFailure(code, reason string, info *ExecutionInfo) PhaseInfo

func PhaseInfoRetryableFailureErr added in v0.1.13

func PhaseInfoRetryableFailureErr(err *core.ExecutionError, info *ExecutionInfo) PhaseInfo

func PhaseInfoRunning added in v0.1.13

func PhaseInfoRunning(info *ExecutionInfo) PhaseInfo

func PhaseInfoSkip added in v0.1.13

func PhaseInfoSkip(info *ExecutionInfo, reason string) PhaseInfo

func PhaseInfoSuccess added in v0.1.13

func PhaseInfoSuccess(info *ExecutionInfo) PhaseInfo

func PhaseInfoTimedOut added in v0.1.17

func PhaseInfoTimedOut(info *ExecutionInfo, reason string) PhaseInfo

func (PhaseInfo) GetErr added in v0.1.13

func (p PhaseInfo) GetErr() *core.ExecutionError

func (PhaseInfo) GetInfo added in v0.1.13

func (p PhaseInfo) GetInfo() *ExecutionInfo

func (PhaseInfo) GetOccurredAt added in v0.1.13

func (p PhaseInfo) GetOccurredAt() time.Time

func (PhaseInfo) GetPhase added in v0.1.13

func (p PhaseInfo) GetPhase() EPhase

func (PhaseInfo) GetReason added in v0.1.13

func (p PhaseInfo) GetReason() string

func (*PhaseInfo) SetErr added in v0.1.13

func (p *PhaseInfo) SetErr(err *core.ExecutionError)

func (*PhaseInfo) SetInfo added in v0.1.13

func (p *PhaseInfo) SetInfo(info *ExecutionInfo)

func (*PhaseInfo) SetOcurredAt added in v0.1.13

func (p *PhaseInfo) SetOcurredAt(t time.Time)

func (*PhaseInfo) SetReason added in v0.1.13

func (p *PhaseInfo) SetReason() string

type SetupContext added in v0.1.13

type SetupContext interface {
	EnqueueOwner() func(string)
	OwnerKind() string
	MetricsScope() promutils.Scope
}

type TaskNodeInfo added in v0.1.13

type TaskNodeInfo struct {
	CacheHit bool
}

type TaskNodeState added in v0.1.13

type TaskNodeState struct {
	PluginPhase        pluginCore.Phase
	PluginPhaseVersion uint32
	PluginState        []byte
	PluginStateVersion uint32
	BarrierClockTick   uint32
	LastPhaseUpdatedAt time.Time
}

type TaskReader added in v0.1.13

type TaskReader interface {
	Read(ctx context.Context) (*core.TaskTemplate, error)
	GetTaskType() v1alpha1.TaskType
	GetTaskID() *core.Identifier
}

type Transition added in v0.1.13

type Transition struct {
	// contains filtered or unexported fields
}

func DoTransition added in v0.1.13

func DoTransition(ttype TransitionType, info PhaseInfo) Transition

func (Transition) Info added in v0.1.13

func (t Transition) Info() PhaseInfo

func (Transition) Type added in v0.1.13

func (t Transition) Type() TransitionType

func (Transition) WithInfo added in v0.1.13

func (t Transition) WithInfo(p PhaseInfo) Transition

type TransitionType added in v0.1.13

type TransitionType int
const (
	TransitionTypeEphemeral TransitionType = iota
	TransitionTypeBarrier
)

type WorkflowNodeInfo added in v0.1.13

type WorkflowNodeInfo struct {
	LaunchedWorkflowID *core.WorkflowExecutionIdentifier
}

type WorkflowNodeState added in v0.1.13

type WorkflowNodeState struct {
	Phase v1alpha1.WorkflowNodePhase
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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