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 | This attribute stores the protobuf representation of the action, which is used to manage the execution and state of a task on the remote API. |
Methods
listall()
@classmethod
def listall(
for_run_name: str,
in_phase: Tuple[ActionPhase | str, ...]| None = None,
sort_by: Tuple[str, Literal["asc", "desc"]]| None = None,
created_at: TimeFilter | None = None,
updated_at: TimeFilter | None = 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` = None |
| created_at | `TimeFilter | None` = None |
| updated_at | `TimeFilter | None` = 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 = None,
run_name: str | None = None,
name: str | None = 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` = None |
| run_name | `str | None` = None |
| name | `str | None` = None |
Returns
| Type | Description |
|---|
[Action](action.md?sid=flyte_remote__action_action) | The Action object corresponding to the provided identifier. |
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 phase. |
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 this action. |
start_time()
@classmethod
def start_time() - > datetime
Get the start time of the action.
Returns
| Type | Description |
|---|
datetime | The UTC datetime when the action started. |
abort()
@classmethod
def abort(
reason: str = "Manually aborted from the SDK."
) - > None
Aborts / Terminates the action.
Parameters
| Name | Type | Description |
|---|
| reason | str = "Manually aborted from the SDK." | The reason for aborting the action. |
Returns
show_logs()
@classmethod
def show_logs(
attempt: int | None = None,
max_lines: int = 30,
show_ts: bool = False,
raw: bool = False,
filter_system: bool = False
) - > None
Display logs for the action.
Parameters
| Name | Type | Description |
|---|
| attempt | `int | None` = None |
| max_lines | int = 30 | Maximum number of log lines to display in the viewer. |
| show_ts | bool = False | Whether to show timestamps with each log line. |
| raw | bool = False | If True, print logs directly without the interactive viewer. |
| filter_system | bool = False | If True, filter out system-generated log lines. |
Returns
get_logs()
@classmethod
def get_logs(
attempt: int | None = None,
filter_system: bool = False,
show_ts: bool = False
) - > AsyncGenerator[str, None]
Get logs for the action as an iterator of strings. Can be called synchronously (returns Iterator[str]) or asynchronously via .aio() (returns AsyncIterator[str]).
Parameters
| Name | Type | Description |
|---|
| attempt | `int | None` = None |
| filter_system | bool = False | If True, filter out system-generated log lines. |
| show_ts | bool = False | If True, prefix each line with an ISO-8601 timestamp. |
Returns
| Type | Description |
|---|
AsyncGenerator[str, None] | An asynchronous generator that yields log lines as strings. |
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 information about the action. |
watch()
@classmethod
def watch(
cache_data_on_done: bool = False,
wait_for: WaitFor = "terminal"
) - > AsyncGenerator[[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails), None]
Watch the action for updates, updating the internal Action state with latest details. This method updates both the cached details and the protobuf representation, ensuring that properties like phase reflect the current state.
Parameters
| Name | Type | Description |
|---|
| cache_data_on_done | bool = False | If True, caches output data when the action reaches a terminal state. |
| wait_for | WaitFor = "terminal" | Specifies the state to wait for before stopping the watch. Can be 'running', 'logs-ready', or 'terminal'. |
Returns
| Type | Description |
|---|
AsyncGenerator[[ActionDetails](actiondetails.md?sid=flyte_remote__action_actiondetails), None] | An asynchronous generator that yields updated ActionDetails objects as the action progresses. |
wait()
@classmethod
def wait(
quiet: bool = False,
wait_for: WaitFor = "terminal"
) - > None
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 = False | If True, suppresses output during the wait. |
| wait_for | WaitFor = "terminal" | Specifies the state to wait for before returning. Can be 'running', 'logs-ready', or 'terminal'. |
Returns
done()
@classmethod
def done() - > bool
Check if the action is done.
Returns
| Type | Description |
|---|
bool | True if the action has reached a terminal state (succeeded, failed, aborted), 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 current Action object, potentially updated with the latest state from the server. |