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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| runID | *common.RunIdentifier | The unique identifier for the run to retrieve. |
Returns
| Type | Description |
|---|
*models.Run, error | The 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| runID | *common.RunIdentifier | The unique identifier of the run to abort. |
| reason | string | The reason for aborting the run. |
| abortedBy | *common.EnrichedIdentity | The identity of the user or system that initiated the abort. |
Returns
| Type | Description |
|---|
error | An 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| action | *models.Action | The action object to create. |
| updateTriggeredAt | bool | A boolean indicating whether the 'triggered_at' timestamp should be updated during creation. |
Returns
| Type | Description |
|---|
*models.Action, error | The 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| events | []*models.ActionEvent | A slice of action event objects to insert. |
Returns
| Type | Description |
|---|
error | An 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action for which to list events. |
| limit | int | The maximum number of events to return. |
Returns
| Type | Description |
|---|
[]*models.ActionEvent, error | A 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action for which to list events. |
| attempt | uint32 | The attempt number of the action for which to list events. |
| since | time.Time | The timestamp from which to retrieve events. Only events after this time will be returned. |
| offset | int | The number of events to skip before starting to return results, used for pagination. |
| limit | int | The maximum number of events to return. |
Returns
| Type | Description |
|---|
[]*models.ActionEvent, error | A 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action. |
| attempt | uint32 | The attempt number of the action. |
Returns
| Type | Description |
|---|
*models.ActionEvent, error | The 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier for the action to retrieve. |
Returns
| Type | Description |
|---|
*models.Action, error | The 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
| Name | Type | Description |
|---|
| ctx | context.Context | The 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
| Type | Description |
|---|
[]*models.Action, error | A 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action to update. |
| phase | common.ActionPhase | The new phase to set for the action (e.g., RUNNING, SUCCEEDED, FAILED). |
| attempts | uint32 | The current number of attempts for the action. |
| cacheStatus | core.CatalogCacheStatus | The caching status of the action's outputs in the catalog. |
| endTime | *time.Time | The timestamp when the action completed, or nil if still running. |
Returns
| Type | Description |
|---|
error | An 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action to abort. |
| reason | string | The reason for aborting the action. |
| abortedBy | *common.EnrichedIdentity | The identity of the user or system that initiated the abort. |
Returns
| Type | Description |
|---|
error | An 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
Returns
| Type | Description |
|---|
[]*models.Action, error | A 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action for which to mark an abort attempt. |
Returns
| Type | Description |
|---|
attemptCount int, err error | The 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action for which to clear the abort request. |
Returns
| Type | Description |
|---|
error | An 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| runID | *common.RunIdentifier | The unique identifier of the run to watch for updates. |
| updates | chan< - *models.Run | A channel to which updated run objects will be sent. |
| errs | chan< - error | A 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| updates | chan< - *models.Run | A channel to which updated run objects will be sent. |
| errs | chan< - error | A 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| runID | *common.RunIdentifier | The unique identifier of the run whose actions to watch for updates. |
| updates | chan< - *models.Action | A channel to which updated action objects will be sent. |
| errs | chan< - error | A 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action to watch for updates. |
| updates | chan< - *models.Action | A channel to which updated action objects will be sent. |
| errs | chan< - error | A 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action whose state is to be updated. |
| state | string | The new state string to set for the action. |
Returns
| Type | Description |
|---|
error | An 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action whose state is to be retrieved. |
Returns
| Type | Description |
|---|
string, error | The 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| actionID | *common.ActionIdentifier | The unique identifier of the action whose state was updated. |
Returns
| Type | Description |
|---|
error | An 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| updates | chan< - *common.ActionIdentifier | A channel to which identifiers of actions with updated states will be sent. |
| errs | chan< - error | A 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
| Name | Type | Description |
|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| project | string | The project name to filter root actions by. |
| domain | string | The domain name to filter root actions by. |
| startDate | *time.Time | An optional start date to filter actions. Only actions triggered after this time will be returned. |
| endDate | *time.Time | An optional end date to filter actions. Only actions triggered before this time will be returned. |
| limit | int | The maximum number of root actions to return. |
Returns
| Type | Description |
|---|
[]*models.Action, error | A slice of root action objects matching the criteria and an error if the operation failed. |