A class representing an action. It is used to manage the run of a task and its state on the remote Union API.
Attributes
| Attribute | Type | Description |
|---|
| pb2 | run_definition_pb2.ActionDetails | The underlying protobuf message containing the raw action details from the remote API. |
Constructor
Signature
def ActionDetails(
pb2: run_definition_pb2.ActionDetails,
_inputs: ActionInputs | None = None,
_outputs: ActionOutputs | None = None,
_preserve_original_types: bool = False
) - > null
Parameters
| Name | Type | Description |
|---|
| pb2 | run_definition_pb2.ActionDetails | The protobuf definition containing the action's details. |
| _inputs | `ActionInputs | None` = None |
| _outputs | `ActionOutputs | None` = None |
| _preserve_original_types | bool = False | Flag indicating whether to preserve original types during data conversion. |
Methods
get_details()
@classmethod
def get_details(
action_id: identifier_pb2.ActionIdentifier
) - > [ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails)
Get the details of the action. This is a placeholder for getting the action details.
Parameters
| Name | Type | Description |
|---|
| action_id | identifier_pb2.ActionIdentifier | The unique identifier for the action to retrieve |
Returns
| Type | Description |
|---|
[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails) | An object containing the full state and configuration of the specified action |
get()
@classmethod
def get(
uri: str | null = null,
run_name: str | null = null,
name: str | null = null
) - > [ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails)
Get a run by its ID or name. If both are provided, the ID will take precedence.
Parameters
| Name | Type | Description |
|---|
| uri | `str | null` = null |
| run_name | `str | null` = null |
| name | `str | null` = null |
Returns
| Type | Description |
|---|
[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails) | The action details corresponding to the provided URI or name |
watch()
@classmethod
def watch(
action_id: identifier_pb2.ActionIdentifier
) - > AsyncIterator[[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails)]
Watch the action for updates. This is a placeholder for watching the action.
Parameters
| Name | Type | Description |
|---|
| action_id | identifier_pb2.ActionIdentifier | The unique identifier of the action to monitor |
Returns
| Type | Description |
|---|
AsyncIterator[[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails)] | An asynchronous iterator yielding updated action details until the action reaches a terminal state |
watch_updates()
@classmethod
def watch_updates(
cache_data_on_done: bool = false
) - > AsyncGenerator[[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails), None]
Watch for updates to the action details, yielding each update until the action is done.
Parameters
| Name | Type | Description |
|---|
| cache_data_on_done | bool = false | If True, cache inputs and outputs when the action completes |
Returns
| Type | Description |
|---|
AsyncGenerator[[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails), None] | An asynchronous generator yielding the latest action state updates |
phase()
@classmethod
def phase() - > [ActionPhase](../../models/actionphase.md?sid=flyte_models_actionphase)
Get the phase of the action.
Returns
| Type | Description |
|---|
[ActionPhase](../../models/actionphase.md?sid=flyte_models_actionphase) | The current execution phase as an ActionPhase enum |
raw_phase()
@classmethod
def raw_phase() - > phase_pb2.ActionPhase
Get the raw phase of the action.
Returns
| Type | Description |
|---|
phase_pb2.ActionPhase | The underlying protobuf representation of the action's current phase |
is_running()
@classmethod
def is_running() - > bool
Check if the action is currently running.
Returns
| Type | Description |
|---|
bool | True if the action phase is currently in the running state, False otherwise |
name()
@classmethod
def name() - > str
Get the name of the action.
Returns
| Type | Description |
|---|
str | The string identifier for the specific action |
run_name()
@classmethod
def run_name() - > str
Get the name of the run.
Returns
| Type | Description |
|---|
str | The name of the parent run associated with this action |
task_name()
@classmethod
def task_name() - > str | null
Get the name of the task.
Returns
action_id()
@classmethod
def action_id() - > identifier_pb2.ActionIdentifier
Get the action ID.
Returns
| Type | Description |
|---|
identifier_pb2.ActionIdentifier | The full protobuf identifier for this action |
@classmethod
def metadata() - > run_definition_pb2.ActionMetadata
Get the metadata of the action.
Returns
| Type | Description |
|---|
run_definition_pb2.ActionMetadata | The metadata object containing configuration and task details |
status()
@classmethod
def status() - > run_definition_pb2.ActionStatus
Get the status of the action.
Returns
| Type | Description |
|---|
run_definition_pb2.ActionStatus | The status object containing phase, timing, and attempt information |
error_info()
@classmethod
def error_info() - > run_definition_pb2.ErrorInfo | null
Get the error information if the action failed, otherwise returns None.
Returns
| Type | Description |
|---|
| `run_definition_pb2.ErrorInfo | null` |
abort_info()
@classmethod
def abort_info() - > run_definition_pb2.AbortInfo | null
Get the abort information if the action was aborted, otherwise returns None.
Returns
| Type | Description |
|---|
| `run_definition_pb2.AbortInfo | null` |
runtime()
@classmethod
def runtime() - > timedelta
Get the runtime of the action.
Returns
| Type | Description |
|---|
timedelta | The total duration the action has been active, calculated from start to end or current time |
get_phase_transitions()
@classmethod
def get_phase_transitions(
attempt: int | null = null
) - > List[PhaseTransitionInfo]
Get the phase transitions for a specific attempt, showing the granular breakdown of time spent in each phase (queued, initializing, running, etc.).
Parameters
| Name | Type | Description |
|---|
| attempt | `int | null` = null |
Returns
| Type | Description |
|---|
List[PhaseTransitionInfo] | List of PhaseTransitionInfo objects, one for each phase the action went through. |
phase_durations()
@classmethod
def phase_durations() - > Dict[[ActionPhase](../../models/actionphase.md?sid=flyte_models_actionphase), timedelta]
Get the duration spent in each phase as a dictionary.
Returns
| Type | Description |
|---|
Dict[[ActionPhase](../../models/actionphase.md?sid=flyte_models_actionphase), timedelta] | Dictionary mapping ActionPhase enum values to timedelta durations. |
queued_time()
@classmethod
def queued_time() - > timedelta | null
Get the time spent in the QUEUED phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | null` |
waiting_for_resources_time()
@classmethod
def waiting_for_resources_time() - > timedelta | null
Get the time spent in the WAITING_FOR_RESOURCES phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | null` |
initializing_time()
@classmethod
def initializing_time() - > timedelta | null
Get the time spent in the INITIALIZING phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | null` |
running_time()
@classmethod
def running_time() - > timedelta | null
Get the time spent in the RUNNING phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | null` |
attempts()
@classmethod
def attempts() - > int
Get the number of attempts of the action.
Returns
| Type | Description |
|---|
int | The total count of execution attempts made for this action |
logs_available()
@classmethod
def logs_available(
attempt: int | null = null
) - > bool
Check if logs are available for the action, optionally for a specific attempt. If attempt is None, it checks for the latest attempt.
Parameters
| Name | Type | Description |
|---|
| attempt | `int | null` = null |
Returns
| Type | Description |
|---|
bool | True if logs can be retrieved for the specified attempt, False otherwise |
@classmethod
def inputs() - > [ActionInputs](actioninputs.md?sid=flyte_remote__action_actioninputs)
Return the inputs of the action. Will return instantly if inputs are available else will fetch and return.
Returns
| Type | Description |
|---|
[ActionInputs](actioninputs.md?sid=flyte_remote__action_actioninputs) | The input data used for this action execution |
outputs()
@classmethod
def outputs() - > [ActionOutputs](actionoutputs.md?sid=flyte_remote__action_actionoutputs)
Returns the outputs of the action, returns instantly if outputs are already cached, else fetches them and returns. If Action is not in a terminal state, raise a RuntimeError.
Returns
| Type | Description |
|---|
[ActionOutputs](actionoutputs.md?sid=flyte_remote__action_actionoutputs) | The output data produced by the action |
done()
@classmethod
def done() - > bool
Check if the action is in a terminal state (completed or failed). This is a placeholder for checking the action state.
Returns
| Type | Description |
|---|
bool | True if the action has finished executing (successfully or otherwise), False if still active |