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 | This attribute stores the protobuf representation of the ActionDetails, which is used to manage the run of a task and its state on the remote Union API. |
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. |
Returns
| Type | Description |
|---|
[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails) | The ActionDetails object containing the details of the action. |
get()
@classmethod
def get(
uri: str | None,
run_name: str | None,
name: str | None
) - > [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 | None` |
| run_name | `str | None` |
| name | `str | None` |
Returns
| Type | Description |
|---|
[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails) | The ActionDetails object corresponding to the specified action. |
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 for the action to watch. |
Returns
| Type | Description |
|---|
AsyncIterator[[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails)] | An asynchronous iterator that yields ActionDetails objects as updates occur. |
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 that yields updated ActionDetails objects. |
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 raw 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's phase is ACTION_PHASE_RUNNING, False otherwise. |
name()
@classmethod
def name() - > str
Get the name of the action.
Returns
| Type | Description |
|---|
str | The name of the action. |
run_name()
@classmethod
def run_name() - > str
Get the name of the run.
Returns
| Type | Description |
|---|
str | The name of the run associated with this action. |
task_name()
@classmethod
def task_name() - > str | None
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 unique identifier for the action. |
@classmethod
def metadata() - > run_definition_pb2.ActionMetadata
Get the metadata of the action.
Returns
| Type | Description |
|---|
run_definition_pb2.ActionMetadata | The metadata associated with the action. |
status()
@classmethod
def status() - > run_definition_pb2.ActionStatus
Get the status of the action.
Returns
| Type | Description |
|---|
run_definition_pb2.ActionStatus | The current status of the action, including its phase and other details. |
error_info()
@classmethod
def error_info() - > 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()
@classmethod
def abort_info() - > 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()
@classmethod
def runtime() - > timedelta
Get the runtime of the action.
Returns
| Type | Description |
|---|
timedelta | A timedelta representing the total duration the action has been running or was running. |
get_phase_transitions()
@classmethod
def get_phase_transitions(
attempt: int | 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` |
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 a mapping of ActionPhase to timedelta for the latest attempt. This provides an easy way to see how long was spent queued, initializing, running, etc.
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 | None
Get the time spent in the QUEUED phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | None` |
waiting_for_resources_time()
@classmethod
def waiting_for_resources_time() - > timedelta | None
Get the time spent in the WAITING_FOR_RESOURCES phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | None` |
initializing_time()
@classmethod
def initializing_time() - > timedelta | None
Get the time spent in the INITIALIZING phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | None` |
running_time()
@classmethod
def running_time() - > timedelta | None
Get the time spent in the RUNNING phase for the latest attempt.
Returns
| Type | Description |
|---|
| `timedelta | None` |
attempts()
@classmethod
def attempts() - > int
Get the number of attempts of the action.
Returns
| Type | Description |
|---|
int | The total number of attempts made for this action. |
logs_available()
@classmethod
def logs_available(
attempt: int | 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` |
Returns
| Type | Description |
|---|
bool | True if logs are available 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 ActionInputs object containing the inputs of the action. |
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 ActionOutputs object containing the outputs of 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 is in a terminal state, False otherwise. |