Skip to main content

ActionsClientInterface

This class defines the interface for actions operations, combining the responsibilities of queue and state clients. It provides methods for enqueuing, updating the status of, and aborting actions, as well as listing child actions. The class also supports subscribing to and unsubscribing from action updates, and managing the watching of TaskAction resources.

Methods


Enqueue()

@classmethod
def Enqueue(
ctx: context.Context,
action: *actions.Action,
runSpec: *task.RunSpec
) - > error

Creates a TaskAction CR in Kubernetes.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation and timeouts.
action*actions.ActionThe action to be enqueued, containing details about the task to be performed.
runSpec*task.RunSpecThe run specification for the action, defining how and where the action should be executed.

Returns

TypeDescription
errorAn error if the TaskAction could not be created.

PutStatus()

@classmethod
def PutStatus(
ctx: context.Context,
actionID: *common.ActionIdentifier,
attempt: uint32,
status: *workflow.ActionStatus
) - > error

Updates the status of a TaskAction.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation and timeouts.
actionID*common.ActionIdentifierThe identifier of the action whose status is being updated.
attemptuint32The attempt number for the action, used to track retries or multiple executions.
status*workflow.ActionStatusThe new status to set for the action, reflecting its current state (e.g., running, completed, failed).

Returns

TypeDescription
errorAn error if the status update failed.

AbortAction()

@classmethod
def AbortAction(
ctx: context.Context,
actionID: *common.ActionIdentifier,
reason: *string
) - > error

Aborts a queued or running action, cascading to descendants.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation and timeouts.
actionID*common.ActionIdentifierThe identifier of the action to be aborted.
reason*stringThe reason for aborting the action, providing context for the cancellation.

Returns

TypeDescription
errorAn error if the action could not be aborted.

ListChildActions()

@classmethod
def ListChildActions(
ctx: context.Context,
parentActionID: *common.ActionIdentifier
) - > []*executorv1.TaskAction, error

Lists all TaskActions that are children of the given parent action.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation and timeouts.
parentActionID*common.ActionIdentifierThe identifier of the parent action for which to list child actions.

Returns

TypeDescription
[]*executorv1.TaskAction, errorA slice of child TaskActions and an error if the listing failed.

Subscribe()

@classmethod
def Subscribe(
parentActionName: string
) - > chan *k8s.ActionUpdate

Creates a new subscription channel for action updates for the given parent action name.

Parameters

NameTypeDescription
parentActionNamestringThe name of the parent action to subscribe to for updates.

Returns

TypeDescription
chan *k8s.ActionUpdateA channel that will receive updates for the specified parent action.

Unsubscribe()

@classmethod
def Unsubscribe(
parentActionName: string,
ch: chan *k8s.ActionUpdate
)

Removes the given channel from the subscription list for the parent action name.

Parameters

NameTypeDescription
parentActionNamestringThe name of the parent action from which to unsubscribe the channel.
chchan *k8s.ActionUpdateThe channel to be removed from the subscription list.

StartWatching()

@classmethod
def StartWatching(
ctx: context.Context
) - > error

Starts watching TaskAction resources.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing cancellation and timeouts.

Returns

TypeDescription
errorAn error if the watcher could not be started.

StopWatching()

@classmethod
def StopWatching()

Stops the TaskAction watcher.