Skip to main content

Action

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

Attributes

AttributeTypeDescription
pb2run_definition_pb2.ActionThe underlying protobuf message containing the action's definition, status, and metadata.

Constructor

Signature

def Action(
pb2: run_definition_pb2.Action,
_details: ActionDetails | None = None
)

Parameters

NameTypeDescription
pb2run_definition_pb2.ActionThe protobuf representation of the action containing status and metadata.
_details`ActionDetailsNone` = None

Methods


listall()

@classmethod
def listall(
for_run_name: str,
in_phase: Tuple[ActionPhase | str, ...]| None,
sort_by: Tuple[str, Literal["asc", "desc"]]| None,
created_at: TimeFilter | None,
updated_at: TimeFilter | None
) - > Union[Iterator[[Action](action.md?sid=flyte_remote__action_action)], AsyncIterator[[Action](action.md?sid=flyte_remote__action_action)]]

Get all actions for a given run.

Parameters

NameTypeDescription
for_run_namestrThe name of the run.
in_phase`Tuple[ActionPhasestr, ...]
sort_by`Tuple[str, Literal["asc", "desc"]]None`
created_at`TimeFilterNone`
updated_at`TimeFilterNone`

Returns

TypeDescription
Union[Iterator[[Action](action.md?sid=flyte_remote__action_action)], AsyncIterator[[Action](action.md?sid=flyte_remote__action_action)]]An iterator of actions.

get()

@classmethod
def get(
uri: str | None,
run_name: str | None,
name: str | None
) - > [Action](action.md?sid=flyte_remote__action_action)

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
[Action](action.md?sid=flyte_remote__action_action)The Action instance corresponding to the provided identifiers

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 underlying protobuf representation of the action phase

name()

@classmethod
def name() - > str

Get the name of the action.

Returns

TypeDescription
strThe unique name identifier of the action

run_name()

@classmethod
def run_name() - > str

Get the name of the run.

Returns

TypeDescription
strThe name of the parent 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 protobuf identifier object for this action

start_time()

@classmethod
def start_time() - > datetime

Get the start time of the action.

Returns

TypeDescription
datetimeThe UTC timestamp when the action execution began

abort()

@classmethod
def abort(
reason: str
)

Aborts / Terminates the action.

Parameters

NameTypeDescription
reasonstrThe explanation for terminating the action, sent to the remote service

show_logs()

@classmethod
def show_logs(
attempt: int | None,
max_lines: int,
show_ts: bool,
raw: bool,
filter_system: bool
)

Display logs for the action.

Parameters

NameTypeDescription
attempt`intNone`
max_linesintMaximum number of log lines to display in the viewer.
show_tsboolWhether to show timestamps with each log line.
rawboolIf True, print logs directly without the interactive viewer.
filter_systemboolIf True, filter out system-generated log lines.

get_logs()

@classmethod
def get_logs(
attempt: int | None,
filter_system: bool,
show_ts: bool
) - > AsyncGenerator[str, None]

Get logs for the action as an iterator of strings.

Parameters

NameTypeDescription
attempt`intNone`
filter_systemboolIf True, filter out system-generated log lines.
show_tsboolIf True, prefix each line with an ISO-8601 timestamp.

Returns

TypeDescription
AsyncGenerator[str, None]An iterator or async generator yielding formatted log lines

details()

@classmethod
def details() - > [ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails)

Get the details of the action. This is a placeholder for getting the action details.

Returns

TypeDescription
[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails)The detailed status and metadata of the action

watch()

@classmethod
def watch(
cache_data_on_done: bool,
wait_for: WaitFor
) - > AsyncGenerator[[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails), None]

Watch the action for updates, updating the internal Action state with latest details.

Parameters

NameTypeDescription
cache_data_on_doneboolIf True, fetches and caches output data once the action reaches a terminal state
wait_forWaitForThe condition to stop watching, such as reaching a terminal state or logs becoming available

Returns

TypeDescription
AsyncGenerator[[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails), None]A generator yielding updated ActionDetails as the action progresses

wait()

@classmethod
def wait(
quiet: bool,
wait_for: WaitFor
)

Wait for the run to complete, displaying a rich progress panel with status transitions, time elapsed, and error details in case of failure.

Parameters

NameTypeDescription
quietboolIf True, suppresses progress output to the console
wait_forWaitForThe specific state or condition to wait for before returning

done()

@classmethod
def done() - > bool

Check if the action is done.

Returns

TypeDescription
boolTrue if the action has reached a terminal phase, False otherwise

sync()

@classmethod
def sync() - > [Action](action.md?sid=flyte_remote__action_action)

Sync the action with the remote server. This is a placeholder for syncing the action.

Returns

TypeDescription
[Action](action.md?sid=flyte_remote__action_action)The synchronized Action instance