Skip to main content

ActionDetails

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

Attributes

AttributeTypeDescription
pb2run_definition_pb2.ActionDetailsThis 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

NameTypeDescription
action_ididentifier_pb2.ActionIdentifierThe unique identifier for the action.

Returns

TypeDescription
[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

NameTypeDescription
uri`strNone`
run_name`strNone`
name`strNone`

Returns

TypeDescription
[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

NameTypeDescription
action_ididentifier_pb2.ActionIdentifierThe unique identifier for the action to watch.

Returns

TypeDescription
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

NameTypeDescription
cache_data_on_donebool = FalseIf True, cache inputs and outputs when the action completes.

Returns

TypeDescription
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

TypeDescription
[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

TypeDescription
phase_pb2.ActionPhaseThe raw protobuf representation of the action's current phase.

is_running()

@classmethod
def is_running() - > bool

Check if the action is currently running.

Returns

TypeDescription
boolTrue if the action's phase is ACTION_PHASE_RUNNING, False otherwise.

name()

@classmethod
def name() - > str

Get the name of the action.

Returns

TypeDescription
strThe name of the action.

run_name()

@classmethod
def run_name() - > str

Get the name of the run.

Returns

TypeDescription
strThe name of the run associated with this action.

task_name()

@classmethod
def task_name() - > str | None

Get the name of the task.

Returns

TypeDescription
`strNone`

action_id()

@classmethod
def action_id() - > identifier_pb2.ActionIdentifier

Get the action ID.

Returns

TypeDescription
identifier_pb2.ActionIdentifierThe unique identifier for the action.

metadata()

@classmethod
def metadata() - > run_definition_pb2.ActionMetadata

Get the metadata of the action.

Returns

TypeDescription
run_definition_pb2.ActionMetadataThe metadata associated with the action.

status()

@classmethod
def status() - > run_definition_pb2.ActionStatus

Get the status of the action.

Returns

TypeDescription
run_definition_pb2.ActionStatusThe 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

TypeDescription
`run_definition_pb2.ErrorInfoNone`

abort_info()

@classmethod
def abort_info() - > run_definition_pb2.AbortInfo | None

Get the abort information if the action was aborted, otherwise returns None.

Returns

TypeDescription
`run_definition_pb2.AbortInfoNone`

runtime()

@classmethod
def runtime() - > timedelta

Get the runtime of the action.

Returns

TypeDescription
timedeltaA 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

NameTypeDescription
attempt`intNone`

Returns

TypeDescription
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

TypeDescription
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

TypeDescription
`timedeltaNone`

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

TypeDescription
`timedeltaNone`

initializing_time()

@classmethod
def initializing_time() - > timedelta | None

Get the time spent in the INITIALIZING phase for the latest attempt.

Returns

TypeDescription
`timedeltaNone`

running_time()

@classmethod
def running_time() - > timedelta | None

Get the time spent in the RUNNING phase for the latest attempt.

Returns

TypeDescription
`timedeltaNone`

attempts()

@classmethod
def attempts() - > int

Get the number of attempts of the action.

Returns

TypeDescription
intThe 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

NameTypeDescription
attempt`intNone`

Returns

TypeDescription
boolTrue if logs are available for the specified attempt, False otherwise.

inputs()

@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

TypeDescription
[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

TypeDescription
[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

TypeDescription
boolTrue if the action is in a terminal state, False otherwise.