Documentation ¶
Index ¶
- Variables
- func NewFallbackClient(cachedClient, rawClient client.Client) client.Client
- type Client
- type DAGStructure
- type DAGStructureWithStartNode
- type ExecutionContext
- func NewExecutionContext(immExecContext ImmutableExecutionContext, tasksGetter TaskDetailsGetter, ...) ExecutionContext
- func NewExecutionContextWithTasksGetter(prevExecContext ExecutionContext, taskGetter TaskDetailsGetter) ExecutionContext
- func NewExecutionContextWithWorkflowGetter(prevExecContext ExecutionContext, getter SubWorkflowGetter) ExecutionContext
- type ImmutableExecutionContext
- type Node
- type NodeLookup
- type NodePhase
- type NodeStatus
- type SubWorkflowGetter
- type TaskDetailsGetter
- type Workflow
Constants ¶
This section is empty.
Variables ¶
var NodeStatusComplete = NodeStatus{NodePhase: NodePhaseComplete}
var NodeStatusPending = NodeStatus{NodePhase: NodePhasePending}
var NodeStatusQueued = NodeStatus{NodePhase: NodePhaseQueued}
var NodeStatusRunning = NodeStatus{NodePhase: NodePhaseRunning}
var NodeStatusSuccess = NodeStatus{NodePhase: NodePhaseSuccess}
var NodeStatusTimedOut = NodeStatus{NodePhase: NodePhaseTimedOut}
var NodeStatusUndefined = NodeStatus{NodePhase: NodePhaseUndefined}
Functions ¶
Types ¶
type Client ¶
type Client interface { // GetClient returns a client configured with the Config GetClient() client.Client // GetCache returns a cache.Cache GetCache() cache.Cache }
A friendly controller-runtime client that gets passed to executors
type DAGStructure ¶ added in v0.2.28
type DAGStructure interface { // Lookup for upstream edges, find all node ids from which this node can be reached. ToNode(id v1alpha1.NodeID) ([]v1alpha1.NodeID, error) // Lookup for downstream edges, find all node ids that can be reached from the given node id. FromNode(id v1alpha1.NodeID) ([]v1alpha1.NodeID, error) }
An interface that captures the Directed Acyclic Graph structure in which the nodes are connected. If NodeLookup and DAGStructure are used together a traversal can be implemented.
func NewLeafNodeDAGStructure ¶ added in v0.2.28
func NewLeafNodeDAGStructure(leafNode v1alpha1.NodeID, parentNodes ...v1alpha1.NodeID) DAGStructure
Returns a new DAGStructure for a leafNode. i.e., there are only incoming edges and no outgoing edges. Also there is no StartNode for this Structure
type DAGStructureWithStartNode ¶ added in v0.2.28
type DAGStructureWithStartNode interface { DAGStructure // The Starting node for the DAG StartNode() v1alpha1.ExecutableNode }
type ExecutionContext ¶ added in v0.2.28
type ExecutionContext interface { ImmutableExecutionContext TaskDetailsGetter SubWorkflowGetter }
func NewExecutionContext ¶ added in v0.2.28
func NewExecutionContext(immExecContext ImmutableExecutionContext, tasksGetter TaskDetailsGetter, workflowGetter SubWorkflowGetter) ExecutionContext
func NewExecutionContextWithTasksGetter ¶ added in v0.2.28
func NewExecutionContextWithTasksGetter(prevExecContext ExecutionContext, taskGetter TaskDetailsGetter) ExecutionContext
func NewExecutionContextWithWorkflowGetter ¶ added in v0.2.28
func NewExecutionContextWithWorkflowGetter(prevExecContext ExecutionContext, getter SubWorkflowGetter) ExecutionContext
type ImmutableExecutionContext ¶ added in v0.2.28
type ImmutableExecutionContext interface { v1alpha1.Meta GetID() v1alpha1.WorkflowID }
type Node ¶
type Node interface { // This method is used specifically to set inputs for start node. This is because start node does not retrieve inputs // from predecessors, but the inputs are inputs to the workflow or inputs to the parent container (workflow) node. SetInputsForStartNode(ctx context.Context, execContext ExecutionContext, dag DAGStructureWithStartNode, nl NodeLookup, inputs *core.LiteralMap) (NodeStatus, error) // This is the main entrypoint to execute a node. It recursively depth-first goes through all ready nodes and starts their execution // This returns either // - 1. It finds a blocking node (not ready, or running) // - 2. A node fails and hence the workflow will fail // - 3. The final/end node has completed and the workflow should be stopped RecursiveNodeHandler(ctx context.Context, execContext ExecutionContext, dag DAGStructure, nl NodeLookup, currentNode v1alpha1.ExecutableNode) (NodeStatus, error) // This aborts the given node. If the given node is complete then it recursively finds the running nodes and aborts them AbortHandler(ctx context.Context, execContext ExecutionContext, dag DAGStructure, nl NodeLookup, currentNode v1alpha1.ExecutableNode, reason string) error FinalizeHandler(ctx context.Context, execContext ExecutionContext, dag DAGStructure, nl NodeLookup, currentNode v1alpha1.ExecutableNode) error // This method should be used to initialize Node executor Initialize(ctx context.Context) error }
Core Node Executor that is used to execute a node. This is a recursive node executor and understands node dependencies
type NodeLookup ¶ added in v0.2.28
type NodeLookup interface { GetNode(nodeID v1alpha1.NodeID) (v1alpha1.ExecutableNode, bool) GetNodeExecutionStatus(ctx context.Context, id v1alpha1.NodeID) v1alpha1.ExecutableNodeStatus }
NodeLookup provides a structure that enables looking up all nodes within the current execution hierarchy/context. NOTE: execution hierarchy may change the nodes available, this is because when a SubWorkflow is being executed, only the nodes within the subworkflow are visible
func NewNodeLookup ¶ added in v0.2.28
func NewNodeLookup(n v1alpha1.NodeGetter, s v1alpha1.NodeStatusGetter) NodeLookup
Returns a Contextual NodeLookup using the given NodeGetter and a separate NodeStatusGetter. Very useful in Subworkflows where the Subworkflow is the reservoir of the nodes, but the status for these nodes maybe stored int he Top-level workflow node itself.
func NewTestNodeLookup ¶ added in v0.2.28
func NewTestNodeLookup(nodes map[v1alpha1.NodeID]v1alpha1.ExecutableNode, status map[v1alpha1.NodeID]v1alpha1.ExecutableNodeStatus) NodeLookup
Returns a new NodeLookup useful in Testing. Not recommended to be used in production
type NodePhase ¶
type NodePhase int
p of the node
const ( // Indicates that the node is not yet ready to be executed and is pending any previous nodes completion NodePhasePending NodePhase = iota // Indicates that the node was queued and will start running soon NodePhaseQueued // Indicates that the payload associated with this node is being executed and is not yet done NodePhaseRunning // Indicates that the nodes payload has been successfully completed, but any downstream nodes from this node may not yet have completed // We could make Success = running, but this enables more granular control NodePhaseSuccess // Complete indicates successful completion of a node. For singular nodes (nodes that have only one execution) success = complete, but, the executor // will always signal completion NodePhaseComplete // Node failed in execution, either this node or anything in the downstream chain NodePhaseFailed // Internal error observed. This state should always be accompanied with an `error`. if not the behavior is undefined NodePhaseUndefined // Finalize node failing due to timeout NodePhaseTimingOut // Node failed because execution timed out NodePhaseTimedOut )
type NodeStatus ¶
type NodeStatus struct { NodePhase NodePhase Err *core.ExecutionError }
Helper struct to allow passing of status between functions
func NodeStatusFailed ¶
func NodeStatusFailed(err *core.ExecutionError) NodeStatus
func (*NodeStatus) HasFailed ¶
func (n *NodeStatus) HasFailed() bool
func (*NodeStatus) HasTimedOut ¶ added in v0.1.17
func (n *NodeStatus) HasTimedOut() bool
func (*NodeStatus) IsComplete ¶
func (n *NodeStatus) IsComplete() bool
func (*NodeStatus) PartiallyComplete ¶
func (n *NodeStatus) PartiallyComplete() bool
type SubWorkflowGetter ¶ added in v0.2.28
type SubWorkflowGetter interface {
FindSubWorkflow(subID v1alpha1.WorkflowID) v1alpha1.ExecutableSubWorkflow
}
type TaskDetailsGetter ¶ added in v0.2.28
type TaskDetailsGetter interface {
GetTask(id v1alpha1.TaskID) (v1alpha1.ExecutableTask, error)
}