handler

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PhasesToString = map[Phase]string{
	PhaseNotStarted:       "NotStarted",
	PhaseQueued:           "Queued",
	PhaseRunning:          "Running",
	PhaseFailing:          "Failing",
	PhaseFailed:           "Failed",
	PhaseSucceeding:       "Succeeding",
	PhaseSuccess:          "Success",
	PhaseSkipped:          "Skipped",
	PhaseUndefined:        "Undefined",
	PhaseRetryableFailure: "RetryableFailure",
}
View Source
var StatusNotStarted = Status{Phase: PhaseNotStarted}
View Source
var StatusQueued = Status{Phase: PhaseQueued}
View Source
var StatusRunning = Status{Phase: PhaseRunning}
View Source
var StatusSkipped = Status{Phase: PhaseSkipped}
View Source
var StatusSucceeding = Status{Phase: PhaseSucceeding}
View Source
var StatusSuccess = Status{Phase: PhaseSuccess}
View Source
var StatusUndefined = Status{Phase: PhaseUndefined}

Functions

This section is empty.

Types

type Data

type Data = core.LiteralMap

type IFace

type IFace interface {

	// Initialize should be called, before invoking any other methods of this handler. Initialize will be called using one thread
	// only
	Initialize(ctx context.Context) error

	// Start node is called for a node only if the recorded state indicates that the node was never started previously.
	// the implementation should handle idempotency, even if the chance of invoking it more than once for an execution is rare.
	StartNode(ctx context.Context, w v1alpha1.ExecutableWorkflow, node v1alpha1.ExecutableNode, nodeInputs *Data) (Status, error)

	// For any node that is not in a NEW/READY state in the recording, CheckNodeStatus will be invoked. The implementation should handle
	// idempotency and return the current observed state of the node
	CheckNodeStatus(ctx context.Context, w v1alpha1.ExecutableWorkflow, node v1alpha1.ExecutableNode, previousNodeStatus v1alpha1.ExecutableNodeStatus) (Status, error)

	// This is called in the case, a node failure is observed.
	HandleFailingNode(ctx context.Context, w v1alpha1.ExecutableWorkflow, node v1alpha1.ExecutableNode) (Status, error)

	// Abort is invoked as a way to clean up failing/aborted workflows
	AbortNode(ctx context.Context, w v1alpha1.ExecutableWorkflow, node v1alpha1.ExecutableNode) error
}

Interface that should be implemented for a node type.

type OutputResolver

type OutputResolver interface {
	// Extracts a subset of node outputs to literals.
	ExtractOutput(ctx context.Context, w v1alpha1.ExecutableWorkflow, n v1alpha1.ExecutableNode,
		bindToVar VarName) (values *core.Literal, err error)
}

type Phase

type Phase int
const (
	// Indicates that the handler was unable to Start the Node due to an internal failure
	PhaseNotStarted Phase = iota
	// Incase of retryable failure and should be retried
	PhaseRetryableFailure
	// Indicates that the node is queued because the task is queued
	PhaseQueued
	// Indicates that the node is currently executing and no errors have been observed
	PhaseRunning
	// PhaseFailing is currently used by SubWorkflow Only. It indicates that the Node's primary work has failed,
	// but, either some cleanup or exception handling condition is in progress
	PhaseFailing
	// This is a terminal Status and indicates that the node execution resulted in a Failure
	PhaseFailed
	// This is a pre-terminal state, currently unused and indicates that the Node execution has succeeded barring any cleanup
	PhaseSucceeding
	// This is a terminal state and indicates successful completion of the node execution.
	PhaseSuccess
	// This Phase indicates that the node execution can be skipped, because of either conditional failures or user defined cases
	PhaseSkipped
	// This phase indicates that an error occurred and is always accompanied by `error`. the execution for that node is
	// in an indeterminate state and should be retried
	PhaseUndefined
)

func (Phase) String

func (p Phase) String() string

type PostNodeSuccessHandler

type PostNodeSuccessHandler interface {
	HandleNodeSuccess(ctx context.Context, w v1alpha1.ExecutableWorkflow, node v1alpha1.ExecutableNode) (Status, error)
}

type Status

type Status struct {
	Phase      Phase
	Err        error
	OccurredAt time.Time
}

This encapsulates the status of the node

func StatusFailed

func StatusFailed(err error) Status

func StatusFailing

func StatusFailing(err error) Status

func StatusRetryableFailure

func StatusRetryableFailure(err error) Status

func (Status) WithOccurredAt

func (s Status) WithOccurredAt(t time.Time) Status

type VarName

type VarName = string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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