Skip to main content

ActionRepo

ActionRepo defines the interface for actions/runs data access

Methods


GetRun()

@classmethod
def GetRun(
ctx: context.Context,
runID: *common.RunIdentifier
) - > *models.Run, error

Fetches a specific run identified by its ID. Callers use this to retrieve details about a particular execution run.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
runID*common.RunIdentifierThe unique identifier for the run to retrieve.

Returns

TypeDescription
*models.Run, errorThe requested run object and an error if the operation failed.

AbortRun()

@classmethod
def AbortRun(
ctx: context.Context,
runID: *common.RunIdentifier,
reason: string,
abortedBy: *common.EnrichedIdentity
) - > error

AbortRun marks only the root action as ABORTED and sets abort_requested_at on it. K8s cascades CRD deletion to child actions via OwnerReferences; the action service informer handles marking them ABORTED in DB when their CRDs are deleted.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
runID*common.RunIdentifierThe unique identifier of the run to abort.
reasonstringThe reason for aborting the run.
abortedBy*common.EnrichedIdentityThe identity of the user or system that initiated the abort.

Returns

TypeDescription
errorAn error if the operation failed.

CreateAction()

@classmethod
def CreateAction(
ctx: context.Context,
action: *models.Action,
updateTriggeredAt: bool
) - > *models.Action, error

Creates a new action in the repository. Callers use this to persist new action definitions.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
action*models.ActionThe action object to create.
updateTriggeredAtboolA boolean indicating whether the 'triggered_at' timestamp should be updated during creation.

Returns

TypeDescription
*models.Action, errorThe created action object, potentially with updated fields like its ID, and an error if the operation failed.

InsertEvents()

@classmethod
def InsertEvents(
ctx: context.Context,
events: []*models.ActionEvent
) - > error

Inserts a batch of action events into the repository. Callers use this to record event history for actions.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
events[]*models.ActionEventA slice of action event objects to insert.

Returns

TypeDescription
errorAn error if the operation failed.

ListEvents()

@classmethod
def ListEvents(
ctx: context.Context,
actionID: *common.ActionIdentifier,
limit: int
) - > []*models.ActionEvent, error

Lists a limited number of events for a specific action. Callers use this to retrieve recent events for an action.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action for which to list events.
limitintThe maximum number of events to return.

Returns

TypeDescription
[]*models.ActionEvent, errorA slice of action event objects and an error if the operation failed.

ListEventsSince()

@classmethod
def ListEventsSince(
ctx: context.Context,
actionID: *common.ActionIdentifier,
attempt: uint32,
since: time.Time,
offset: int,
limit: int
) - > []*models.ActionEvent, error

Lists action events for a specific action and attempt, starting from a given timestamp. Callers use this to retrieve events that occurred after a certain point in time for a particular action attempt.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action for which to list events.
attemptuint32The attempt number of the action for which to list events.
sincetime.TimeThe timestamp from which to retrieve events. Only events after this time will be returned.
offsetintThe number of events to skip before starting to return results, used for pagination.
limitintThe maximum number of events to return.

Returns

TypeDescription
[]*models.ActionEvent, errorA slice of action event objects and an error if the operation failed.

GetLatestEventByAttempt()

@classmethod
def GetLatestEventByAttempt(
ctx: context.Context,
actionID: *common.ActionIdentifier,
attempt: uint32
) - > *models.ActionEvent, error

Retrieves the latest event for a specific action and attempt. Callers use this to get the most recent status or information for an action's attempt.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action.
attemptuint32The attempt number of the action.

Returns

TypeDescription
*models.ActionEvent, errorThe latest action event object for the specified attempt and an error if the operation failed or no event is found.

GetAction()

@classmethod
def GetAction(
ctx: context.Context,
actionID: *common.ActionIdentifier
) - > *models.Action, error

Fetches a specific action identified by its ID. Callers use this to retrieve details about a particular action.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier for the action to retrieve.

Returns

TypeDescription
*models.Action, errorThe requested action object and an error if the operation failed.

ListActions()

@classmethod
def ListActions(
ctx: context.Context,
input: [ListResourceInput](listresourceinput.md?sid=runs_repository_interfaces_listresourceinput)
) - > []*models.Action, error

Lists actions based on provided input criteria. Callers use this to query and filter actions.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
input[ListResourceInput](listresourceinput.md?sid=runs_repository_interfaces_listresourceinput)The input parameters for filtering and pagination of actions.

Returns

TypeDescription
[]*models.Action, errorA slice of action objects matching the criteria and an error if the operation failed.

UpdateActionPhase()

@classmethod
def UpdateActionPhase(
ctx: context.Context,
actionID: *common.ActionIdentifier,
phase: common.ActionPhase,
attempts: uint32,
cacheStatus: core.CatalogCacheStatus,
endTime: *time.Time
) - > error

Updates the phase, attempt count, cache status, and end time of a specific action. Callers use this to reflect the current state and progress of an action.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action to update.
phasecommon.ActionPhaseThe new phase to set for the action (e.g., RUNNING, SUCCEEDED, FAILED).
attemptsuint32The current number of attempts for the action.
cacheStatuscore.CatalogCacheStatusThe caching status of the action's outputs in the catalog.
endTime*time.TimeThe timestamp when the action completed, or nil if still running.

Returns

TypeDescription
errorAn error if the operation failed.

AbortAction()

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

AbortAction marks only the targeted action as ABORTED and sets abort_requested_at. K8s cascades CRD deletion to descendants via OwnerReferences.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action to abort.
reasonstringThe reason for aborting the action.
abortedBy*common.EnrichedIdentityThe identity of the user or system that initiated the abort.

Returns

TypeDescription
errorAn error if the operation failed.

ListPendingAborts()

@classmethod
def ListPendingAborts(
ctx: context.Context
) - > []*models.Action, error

Lists all actions that have a pending abort request. Callers use this to identify actions that need to be processed for abortion.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.

Returns

TypeDescription
[]*models.Action, errorA slice of action objects with pending abort requests and an error if the operation failed.

MarkAbortAttempt()

@classmethod
def MarkAbortAttempt(
ctx: context.Context,
actionID: *common.ActionIdentifier
) - > attemptCount int, err error

Marks an attempt to abort an action, incrementing an internal counter. Callers use this to track and manage the reconciliation process for aborting actions.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action for which to mark an abort attempt.

Returns

TypeDescription
attemptCount int, err errorThe updated count of abort attempts and an error if the operation failed.

ClearAbortRequest()

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

Clears any pending abort request for a specific action. Callers use this to indicate that an action's abort process has been completed or cancelled.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action for which to clear the abort request.

Returns

TypeDescription
errorAn error if the operation failed.

WatchRunUpdates()

@classmethod
def WatchRunUpdates(
ctx: context.Context,
runID: *common.RunIdentifier,
updates: chan< - *models.Run,
errs: chan< - error
)

Establishes a watch for updates to a specific run, streaming changes to provided channels. Callers use this to receive real-time notifications about a run's status and data.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
runID*common.RunIdentifierThe unique identifier of the run to watch for updates.
updateschan< - *models.RunA channel to which updated run objects will be sent.
errschan< - errorA channel to which errors encountered during the watch will be sent.

WatchAllRunUpdates()

@classmethod
def WatchAllRunUpdates(
ctx: context.Context,
updates: chan< - *models.Run,
errs: chan< - error
)

Establishes a watch for updates to all runs, streaming changes to provided channels. Callers use this to receive real-time notifications about any run's status and data.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
updateschan< - *models.RunA channel to which updated run objects will be sent.
errschan< - errorA channel to which errors encountered during the watch will be sent.

WatchAllActionUpdates()

@classmethod
def WatchAllActionUpdates(
ctx: context.Context,
runID: *common.RunIdentifier,
updates: chan< - *models.Action,
errs: chan< - error
)

Establishes a watch for updates to all actions within a specific run, streaming changes to provided channels. Callers use this to receive real-time notifications about the status and data of all actions belonging to a run.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
runID*common.RunIdentifierThe unique identifier of the run whose actions to watch for updates.
updateschan< - *models.ActionA channel to which updated action objects will be sent.
errschan< - errorA channel to which errors encountered during the watch will be sent.

WatchActionUpdates()

@classmethod
def WatchActionUpdates(
ctx: context.Context,
actionID: *common.ActionIdentifier,
updates: chan< - *models.Action,
errs: chan< - error
)

Establishes a watch for updates to a specific action, streaming changes to provided channels. Callers use this to receive real-time notifications about an action's status and data.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action to watch for updates.
updateschan< - *models.ActionA channel to which updated action objects will be sent.
errschan< - errorA channel to which errors encountered during the watch will be sent.

UpdateActionState()

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

Updates the custom state string for a specific action. Callers use this to store arbitrary state information associated with an action.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action whose state is to be updated.
statestringThe new state string to set for the action.

Returns

TypeDescription
errorAn error if the operation failed.

GetActionState()

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

Retrieves the custom state string for a specific action. Callers use this to fetch previously stored arbitrary state information associated with an action.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action whose state is to be retrieved.

Returns

TypeDescription
string, errorThe custom state string for the action and an error if the operation failed.

NotifyStateUpdate()

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

Notifies the system that an action's state has been updated. Callers use this to trigger any listeners or watchers interested in state changes for a particular action.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
actionID*common.ActionIdentifierThe unique identifier of the action whose state was updated.

Returns

TypeDescription
errorAn error if the notification failed.

WatchStateUpdates()

@classmethod
def WatchStateUpdates(
ctx: context.Context,
updates: chan< - *common.ActionIdentifier,
errs: chan< - error
)

Establishes a watch for state updates across actions, streaming identifiers of updated actions to provided channels. Callers use this to receive real-time notifications when any action's state changes.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
updateschan< - *common.ActionIdentifierA channel to which identifiers of actions with updated states will be sent.
errschan< - errorA channel to which errors encountered during the watch will be sent.

ListRootActions()

@classmethod
def ListRootActions(
ctx: context.Context,
project: string,
domain: string,
startDate: *time.Time,
endDate: *time.Time,
limit: int
) - > []*models.Action, error

Lists root actions within a specified project and domain, optionally filtered by a date range and limited by count. Callers use this to retrieve top-level actions for reporting or overview purposes.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
projectstringThe project name to filter root actions by.
domainstringThe domain name to filter root actions by.
startDate*time.TimeAn optional start date to filter actions. Only actions triggered after this time will be returned.
endDate*time.TimeAn optional end date to filter actions. Only actions triggered before this time will be returned.
limitintThe maximum number of root actions to return.

Returns

TypeDescription
[]*models.Action, errorA slice of root action objects matching the criteria and an error if the operation failed.