A class representing an action. It is used to manage the "execution" of a task and its state on the remote API.
Attributes
| Attribute | Type | Description |
|---|
| pb2 | run_definition_pb2.Action | The 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
| Name | Type | Description |
|---|
| pb2 | run_definition_pb2.Action | The protobuf representation of the action containing status and metadata. |
| _details | `ActionDetails | None` = 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
| Name | Type | Description |
|---|
| for_run_name | str | The name of the run. |
| in_phase | `Tuple[ActionPhase | str, ...] |
| sort_by | `Tuple[str, Literal["asc", "desc"]] | None` |
| created_at | `TimeFilter | None` |
| updated_at | `TimeFilter | None` |
Returns
| Type | Description |
|---|
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
| Name | Type | Description |
|---|
| uri | `str | None` |
| run_name | `str | None` |
| name | `str | None` |
Returns
| Type | Description |
|---|
[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
| 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 underlying protobuf representation of the action phase |
name()
@classmethod
def name() - > str
Get the name of the action.
Returns
| Type | Description |
|---|
str | The unique name identifier of the action |
run_name()
@classmethod
def run_name() - > str
Get the name of the run.
Returns
| Type | Description |
|---|
str | The name of the parent 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 protobuf identifier object for this action |
start_time()
@classmethod
def start_time() - > datetime
Get the start time of the action.
Returns
| Type | Description |
|---|
datetime | The UTC timestamp when the action execution began |
abort()
@classmethod
def abort(
reason: str
)
Aborts / Terminates the action.
Parameters
| Name | Type | Description |
|---|
| reason | str | The 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
| Name | Type | Description |
|---|
| attempt | `int | None` |
| max_lines | int | Maximum number of log lines to display in the viewer. |
| show_ts | bool | Whether to show timestamps with each log line. |
| raw | bool | If True, print logs directly without the interactive viewer. |
| filter_system | bool | If 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
| Name | Type | Description |
|---|
| attempt | `int | None` |
| filter_system | bool | If True, filter out system-generated log lines. |
| show_ts | bool | If True, prefix each line with an ISO-8601 timestamp. |
Returns
| Type | Description |
|---|
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
| Type | Description |
|---|
[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
| Name | Type | Description |
|---|
| cache_data_on_done | bool | If True, fetches and caches output data once the action reaches a terminal state |
| wait_for | WaitFor | The condition to stop watching, such as reaching a terminal state or logs becoming available |
Returns
| Type | Description |
|---|
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
| Name | Type | Description |
|---|
| quiet | bool | If True, suppresses progress output to the console |
| wait_for | WaitFor | The specific state or condition to wait for before returning |
done()
@classmethod
def done() - > bool
Check if the action is done.
Returns
| Type | Description |
|---|
bool | True 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
| Type | Description |
|---|
[Action](action.md?sid=flyte_remote__action_action) | The synchronized Action instance |