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 | Underlying protobuf representation containing the remote execution status, identifiers, and metadata of the action. |
Methods
get_details()
@syncify
@classmethod
async def get_details(cls, action_id: identifier_pb2.ActionIdentifier) -> 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 protobuf specifying the action to retrieve. |
Returns
| Type | Description |
|---|
[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails) | An ActionDetails instance containing action state and configuration fetched from the remote service. |
get()
@syncify
@classmethod
async def get(
cls,
uri: str | None = None,
/,
run_name: str | None = None,
name: str | None = None,
) -> ActionDetails: ...
Get a run by its ID or name. If both are provided, the ID will take precedence.
Parameters
| Name | Type | Description |
|---|
| uri | `str | None` = None |
| run_name | `str | None` = None |
| name | `str | None` = None |
Returns
| Type | Description |
|---|
[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails) | An ActionDetails instance populated with the requested action's details. |
watch()
@syncify
@classmethod
async def watch(cls, action_id: identifier_pb2.ActionIdentifier) -> AsyncIterator[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 watch for status updates. |
Returns
| Type | Description |
|---|
AsyncIterator[[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails)] | An async iterator yielding ActionDetails instances as the action's status updates until completion. |
watch_updates()
async def watch_updates(self, cache_data_on_done: bool = False) -> AsyncGenerator[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 async generator yielding updated ActionDetails instances until the action terminates. |
phase()
@property
def phase(self) -> 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()
@property
def raw_phase(self) -> phase_pb2.ActionPhase: ...
Get the raw phase of the action.
Returns
| Type | Description |
|---|
phase_pb2.ActionPhase | The raw protobuf enum representing the action phase. |
is_running()
@property
def is_running(self) -> bool: ...
Check if the action is currently running.
Returns
| Type | Description |
|---|
bool | True if the action's current phase is ACTION_PHASE_RUNNING, otherwise False. |
name()
@property
def name(self) -> str: ...
Get the name of the action.
Returns
| Type | Description |
|---|
str | The string name of the action. |
run_name()
@property
def run_name(self) -> str: ...
Get the name of the run.
Returns
| Type | Description |
|---|
str | The name of the parent run associated with this action. |
task_name()
@property
def task_name(self) -> str | None: ...
Get the name of the task.
Returns
action_id()
@property
def action_id(self) -> identifier_pb2.ActionIdentifier: ...
Get the action ID.
Returns
| Type | Description |
|---|
identifier_pb2.ActionIdentifier | The protobuf identifier object for this action. |
@property
def metadata(self) -> run_definition_pb2.ActionMetadata: ...
Get the metadata of the action.
Returns
| Type | Description |
|---|
run_definition_pb2.ActionMetadata | The protobuf ActionMetadata structure associated with the action. |
status()
@property
def status(self) -> run_definition_pb2.ActionStatus: ...
Get the status of the action.
Returns
| Type | Description |
|---|
run_definition_pb2.ActionStatus | The protobuf ActionStatus containing status and execution timestamps. |
error_info()
@property
def error_info(self) -> run_definition_pb2.ErrorInfo | None: ...
Get the error information if the action failed, otherwise returns None.
Returns
| Type | Description |
|---|
| `run_definition_pb2.ErrorInfo | None` |
abort_info()
@property
def abort_info(self) -> run_definition_pb2.AbortInfo | None: ...
Get the abort information if the action was aborted, otherwise returns None.
Returns
| Type | Description |
|---|
| `run_definition_pb2.AbortInfo | None` |
runtime()
@property
def runtime(self) -> timedelta: ...
Get the runtime of the action.
Returns
| Type | Description |
|---|
timedelta | The total duration of the action execution from start time to end time (or current time if running). |
get_phase_transitions()
def get_phase_transitions(self, attempt: int | None = None) -> 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 | None` = None |
Returns
| Type | Description |
|---|
List[PhaseTransitionInfo] | List of PhaseTransitionInfo objects, one for each phase the action went through. |
phase_durations()
@property
def phase_durations(self) -> Dict[ActionPhase, timedelta]: ...
Get the duration spent in each phase as a dictionary. Returns a mapping of ActionPhase to timedelta for the latest attempt.
Returns
| Type | Description |
|---|
Dict[[ActionPhase](../../models/actionphase.md?sid=flyte_models_actionphase), timedelta] | Dictionary mapping ActionPhase enum values to timedelta durations. |
queued_time()
@property
def queued_time(self) -> timedelta | None: ...
Get the time spent in the QUEUED phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | None` |
waiting_for_resources_time()
@property
def waiting_for_resources_time(self) -> timedelta | None: ...
Get the time spent in the WAITING_FOR_RESOURCES phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | None` |
initializing_time()
@property
def initializing_time(self) -> timedelta | None: ...
Get the time spent in the INITIALIZING phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | None` |
running_time()
@property
def running_time(self) -> timedelta | None: ...
Get the time spent in the RUNNING phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | None` |
attempts()
@property
def attempts(self) -> int: ...
Get the number of attempts of the action.
Returns
| Type | Description |
|---|
int | The total count of execution attempts performed for this action. |
logs_available()
def logs_available(self, attempt: int | None = None) -> 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 | None` = None |
Returns
| Type | Description |
|---|
bool | True if execution logs are available for the specified or latest attempt, otherwise False. |
async def inputs(self) -> 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 cached or freshly fetched ActionInputs object containing input parameters. |
outputs()
async def outputs(self) -> 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) | ActionOutputs containing the output values produced by the action execution. |
done()
def done(self) -> 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 reached a terminal execution phase, False otherwise. |