Skip to main content

Run

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

Attributes

AttributeTypeDescription
pb2run_definition_pb2.RunA protobuf object representing the run definition, storing the underlying data structure for the run.
action[Action](../action/action.md?sid=flyte_remote__action_action)An Action object representing the action associated with this run, managing its state and behavior.

Methods


listall()

@classmethod
def listall(
in_phase: Tuple[ActionPhase | str, ...]| None = None,
task_name: str | None = None,
task_version: str | None = None,
created_by_subject: str | None = None,
sort_by: Tuple[str, Literal["asc", "desc"]]| None = None,
limit: int = 100,
project: str | None = None,
domain: str | None = None,
created_at: TimeFilter | None = None,
updated_at: TimeFilter | None = None
) - > AsyncIterator[[Run](run.md?sid=flyte_remote__run_run)]

Get all runs for the current project and domain.

Parameters

NameTypeDescription
in_phase`Tuple[ActionPhasestr, ...]
task_name`strNone` = None
task_version`strNone` = None
created_by_subject`strNone` = None
sort_by`Tuple[str, Literal["asc", "desc"]]None` = None
limitint = 100The maximum number of runs to return.
project`strNone` = None
domain`strNone` = None
created_at`TimeFilterNone` = None
updated_at`TimeFilterNone` = None

Returns

TypeDescription
AsyncIterator[[Run](run.md?sid=flyte_remote__run_run)]An iterator of runs.

get()

@classmethod
def get(
name: str
) - > [Run](run.md?sid=flyte_remote__run_run)

Get the current run.

Parameters

NameTypeDescription
namestrThe name of the run to retrieve.

Returns

TypeDescription
[Run](run.md?sid=flyte_remote__run_run)The current run.

name()

@classmethod
def name() - > str

Get the name of the run.

Returns

TypeDescription
str

phase()

@classmethod
def phase() - > str

Get the phase of the run.

Returns

TypeDescription
str

raw_phase()

@classmethod
def raw_phase() - > phase_pb2.ActionPhase

Get the raw phase of the run.

Returns

TypeDescription
phase_pb2.ActionPhase

wait()

@classmethod
def wait(
quiet: bool = False,
wait_for: Literal["terminal", "running"] = "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. This method updates the Run's internal state, ensuring that properties like run.action.phase reflect the final state after waiting completes.

Parameters

NameTypeDescription
quietbool = FalseIf True, suppresses the rich progress panel output during waiting.
wait_forLiteral["terminal", "running"] = "terminal"Specifies the state to wait for. 'terminal' waits until the run reaches a final state (success, failure, aborted). 'running' waits until the run enters the running phase.

Returns

TypeDescription
None

watch()

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

Watch the run for updates, updating the internal Run state with latest details. This method updates the Run's action state, ensuring that properties like run.action.phase reflect the current state after watching.

Parameters

NameTypeDescription
cache_data_on_donebool = FalseIf True, caches the final run details once the run is done.

Returns

TypeDescription
AsyncGenerator[[ActionDetails](../action/actiondetails.md?sid=flyte_remote__action_actiondetails), None]An asynchronous generator that yields ActionDetails objects as the run's state updates.

show_logs()

@classmethod
def show_logs(
attempt: int | None = None,
max_lines: int = 100,
show_ts: bool = False,
raw: bool = False,
filter_system: bool = False
) - > None

Displays the logs for the run to the console. This method internally calls the action's show_logs method to retrieve and print the logs.

Parameters

NameTypeDescription
attempt`intNone` = None
max_linesint = 100The maximum number of log lines to display.
show_tsbool = FalseIf True, prefixes each log line with an ISO-8601 timestamp.
rawbool = FalseIf True, displays raw log output without additional formatting.
filter_systembool = FalseIf True, filters out system-generated log lines, showing only user-generated logs.

Returns

TypeDescription
None

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 run as an iterator of strings. Can be called synchronously (returns Iterator[str]) or asynchronously via .aio() (returns AsyncIterator[str]).

Parameters

NameTypeDescription
attempt`intNone` = None
filter_systembool = FalseIf True, filter out system-generated log lines.
show_tsbool = FalseIf True, prefix each line with an ISO-8601 timestamp.

Returns

TypeDescription
AsyncGenerator[str, None]

details()

@classmethod
def details() - > [RunDetails](rundetails.md?sid=flyte_remote__run_rundetails)

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

Returns

TypeDescription
[RunDetails](rundetails.md?sid=flyte_remote__run_rundetails)

inputs()

@classmethod
def inputs() - > [ActionInputs](../action/actioninputs.md?sid=flyte_remote__action_actioninputs)

Get the inputs of the run. This is a placeholder for getting the run inputs.

Returns

TypeDescription
[ActionInputs](../action/actioninputs.md?sid=flyte_remote__action_actioninputs)

outputs()

@classmethod
def outputs() - > [ActionOutputs](../action/actionoutputs.md?sid=flyte_remote__action_actionoutputs)

Get the outputs of the run. This is a placeholder for getting the run outputs.

Returns

TypeDescription
[ActionOutputs](../action/actionoutputs.md?sid=flyte_remote__action_actionoutputs)

url()

@classmethod
def url() - > str

Get the URL of the run.

Returns

TypeDescription
str

get_debug_url()

@classmethod
def get_debug_url() - > str

Get the debug URL of the run. Returns None if the VS Code Debugger log entry is not yet available in the action details.

Returns

TypeDescription
str

abort()

@classmethod
def abort(
reason: str = "Manually aborted from the SDK api."
) - > None

Aborts / Terminates the run.

Parameters

NameTypeDescription
reasonstr = "Manually aborted from the SDK api."The reason for aborting the run.

Returns

TypeDescription
None

done()

@classmethod
def done() - > bool

Check if the run is done.

Returns

TypeDescription
bool

sync()

@classmethod
def sync() - > [Run](run.md?sid=flyte_remote__run_run)

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

Returns

TypeDescription
[Run](run.md?sid=flyte_remote__run_run)