2.12.2

ActionDetails

Package: flyte.remote

A class representing an action. It is used to manage the run of a task and its state on the remote Union API.

Parameters

class ActionDetails(
    pb2: run_definition_pb2.ActionDetails,
)
Parameter Type Description
pb2 run_definition_pb2.ActionDetails

Properties

Property Type Description
abort_info run_definition_pb2.AbortInfo | None Get the abort information if the action was aborted, otherwise returns None.
action_id identifier_pb2.ActionIdentifier Get the action ID.
attempts int Get the number of attempts of the action.
code_bundle CodeBundle | None The code bundle this action ran, or None when the task ran from code baked into its image. This is metadata only — where the bundle lives and which version it is. Use Action.download_code or Run.download_code to fetch the source itself.
error_info run_definition_pb2.ErrorInfo | None Get the error information if the action failed, otherwise returns None.
error_message str The error message of a failed action, or an empty string when the action did not fail (or carries no error details).
initializing_time timedelta | None Get the time spent in the INITIALIZING phase for the latest attempt.
is_running bool Check if the action is currently running.
metadata run_definition_pb2.ActionMetadata Get the metadata of the action.
name str Get the name of the action.
parent_name str | None Name of the action this one is nested under, or None for the root action.
phase ActionPhase Get the phase of the action.
phase_durations Dict[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.
queued_time timedelta | None Get the time spent in the QUEUED phase for the latest attempt.
raw_phase phase_pb2.ActionPhase Get the raw phase of the action.
relation None Provenance link (flyteidl2.common.run_pb2.Relation: related_to + relation_type) if this run was derived from another (rerun/recover), otherwise None. Only set on root actions; requires a flyteidl2 build that ships ActionMetadata.relation.
run_name str Get the name of the run.
running_time timedelta | None Get the time spent in the RUNNING phase for the latest attempt.
runtime timedelta Get the runtime of the action.
status run_definition_pb2.ActionStatus Get the status of the action.
task_name str | None Get the name of the task.
waiting_for_resources_time timedelta | None Get the time spent in the WAITING_FOR_RESOURCES phase for the latest attempt.

Methods

Method Description
done() Check if the action is in a terminal state (completed or failed).
get() Get a run by its ID or name.
get_details() Get the details of the action.
get_phase_transitions() Get the phase transitions for a specific attempt, showing the granular breakdown of time spent in each phase (queued, initializing, running, etc.).
logs_available() Check if logs are available for the action, optionally for a specific attempt.
to_dict() Convert the object to a JSON-serializable dictionary.
to_json() Convert the object to a JSON string.
watch() Watch the action for updates, yielding details until the action reaches a terminal phase.
watch_updates() Watch for updates to the action details, yielding each update until the action is done.

done()

def done()

Check if the action is in a terminal state (completed or failed). This is a placeholder for checking the action state.

get()

This method can be called both synchronously or asynchronously.

Default invocation is sync and will block. To call it asynchronously, use the function .aio() on the method name itself, e.g.,: result = await ActionDetails.get.aio().

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.

Parameter Type Description
cls
uri str | None The URI of the action.
run_name str | None The name of the run.
name str | None The name of the action.

get_details()

This method can be called both synchronously or asynchronously.

Default invocation is sync and will block. To call it asynchronously, use the function .aio() on the method name itself, e.g.,: result = await ActionDetails.get_details.aio().

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.

Parameter Type Description
cls
action_id identifier_pb2.ActionIdentifier

get_phase_transitions()

def get_phase_transitions(
    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.).

Parameter Type Description
attempt int | None The attempt number (1-indexed). If None, uses the latest attempt.

Returns

List of PhaseTransitionInfo objects, one for each phase the action went through.

logs_available()

def logs_available(
    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.

Parameter Type Description
attempt int | None

to_dict()

def to_dict()

Convert the object to a JSON-serializable dictionary.

Returns: dict: A dictionary representation of the object.

to_json()

def to_json()

Convert the object to a JSON string.

Returns: str: A JSON string representation of the object.

watch()

This method can be called both synchronously or asynchronously.

Default invocation is sync and will block. To call it asynchronously, use the function .aio() on the method name itself, e.g.,: result = await ActionDetails.watch.aio().

def watch(
    cls,
    action_id: identifier_pb2.ActionIdentifier,
) -> AsyncIterator[ActionDetails]

Watch the action for updates, yielding details until the action reaches a terminal phase.

The underlying server stream rides a single HTTP/2 stream that proxies and load balancers are free to reset at any time (idle timeouts, connection churn), long before a slow action finishes. Those interruptions — including streams that end cleanly before a terminal phase — are re-subscribed transparently, so this generator only ends at a terminal phase or raises on a non-transient error / persistent reconnect failure.

Parameter Type Description
cls
action_id identifier_pb2.ActionIdentifier

watch_updates()

def watch_updates(
    cache_data_on_done: bool = False,
) -> AsyncGenerator[ActionDetails, None]

Watch for updates to the action details, yielding each update until the action is done.

Parameter Type Description
cache_data_on_done bool If True, cache inputs and outputs when the action completes.