Skip to main content

orbitra.flows.client

Functions

get_flows_client

Get an authenticated OrbitraFlowsClient for the Orbitra Flows (Prefect) API. Args:
  • environment: The environment to get the API URL from. Defaults to None, which resolves it from the Orbitra settings sources.
Returns:
  • An authenticated OrbitraFlowsClient instance.
Examples:

Classes

OrbitraFlowsClient

A wrapper around SyncPrefectClient for interacting with Orbitra Flows. Methods:

api_url

Get the API URL of the Orbitra Flows server.

get_deployment_runs

Get the flow runs of a deployment by its decorated callable. The deployment name is resolved the same way as in run_deployment. Args:
  • deployment: The callable decorated with @orbitra_deployment.
  • orbitra_flows_name_suffix: Suffix appended to the flow name. When omitted, reads from ClientSettings.orbitra_flows_name_suffix, and falls back to no suffix when that is unset too.
  • orbitra_flows_deployment_suffix: Suffix appended to the deployment name. When omitted, reads from ClientSettings.orbitra_flows_deployment_suffix, and falls back to no suffix when that is unset too.
  • limit: Maximum number of flow runs to return, from 1 to 100. Defaults to 10.
  • offset: Number of flow runs to skip, for pagination. Defaults to 0.
  • state_types: Only return runs in one of these states. Defaults to None (any state).
  • start_time: Only return runs that started at or after this time. A naive datetime is read as UTC. Defaults to None (no lower bound).
  • end_time: Only return runs that started at or before this time, so a run still going counts by when it started. A naive datetime is read as UTC. Defaults to None (no upper bound).
  • sort: The order of the returned runs. Defaults to FlowRunSort.START_TIME_DESC (most recent first).
Returns:
  • list[FlowRunInfo]: The deployment’s flow runs. Empty if it has none.
Raises:
  • ValueError: If limit is outside 1..100 or offset is negative.
  • FlowsError: If the deployment does not exist.
Examples:

get_deployment_runs_by_name

Get the flow runs of a Prefect deployment by name. Only runs created from this deployment are returned, not every run of its flow. Args:
  • deployment_name: The name of the deployment in the format <FLOW_NAME>/<DEPLOYMENT_NAME>.
  • limit: Maximum number of flow runs to return, from 1 to 100. Defaults to 10.
  • offset: Number of flow runs to skip, for pagination. Defaults to 0.
  • state_types: Only return runs in one of these states. Defaults to None (any state).
  • start_time: Only return runs that started at or after this time. A naive datetime is read as UTC. Defaults to None (no lower bound).
  • end_time: Only return runs that started at or before this time, so a run still going counts by when it started. A naive datetime is read as UTC. Defaults to None (no upper bound).
  • sort: The order of the returned runs. Defaults to FlowRunSort.START_TIME_DESC (most recent first).
Returns:
  • list[FlowRunInfo]: The deployment’s flow runs. Empty if it has none.
Raises:
  • ValueError: If limit is outside 1..100 or offset is negative.
  • FlowsError: If the deployment does not exist.
Examples:

get_flow_run_logs_by_id

Get the logs emitted by a flow run, ordered oldest to newest. Args:
  • flow_run_id: The ID of the flow run to get logs for.
  • limit: Maximum number of log records to return. Defaults to None (no limit).
Returns:
  • list[Log]: The flow run’s logs sorted by timestamp ascending. Empty if the run has no logs or if no run exists with the given ID.
Examples:

list_deployments

List the deployments registered in Orbitra Flows. Every page of the server response is read, so the result is never truncated by the server’s default limit. Args:
  • name_like: Case-insensitive partial match on the deployment name. Defaults to None (all deployments).
  • sort: The order of the returned deployments. Defaults to DeploymentSort.NAME_ASC.
Returns:
  • list[DeploymentInfo]: The matching deployments. Empty if none match.
Examples:

run_deployment

Run a deployment by its decorated callable. Only deployment is positional; everything else must be passed by keyword, so a flow parameter can never be mistaken for a suffix. Args:
  • deployment: The callable decorated with @orbitra_deployment.
  • orbitra_flows_name_suffix: Suffix appended to the flow name. When omitted, reads from ClientSettings.orbitra_flows_name_suffix, and falls back to no suffix when that is unset too.
  • orbitra_flows_deployment_suffix: Suffix appended to the deployment name. When omitted, reads from ClientSettings.orbitra_flows_deployment_suffix, and falls back to no suffix when that is unset too.
  • **kwargs: Parameters forwarded to the flow run.
Returns:
  • The ID of the created flow run.
Examples:

run_deployment_by_name

Run a Prefect deployment by name. Args:
  • deployment_name: The name of the deployment to run in the format <FLOW_NAME>/<DEPLOYMENT_NAME>.
  • parameters: Parameters to pass to the flow run. Defaults to None.
Returns:
  • The ID of the created flow run.
Examples:

sync_prefect_client

The underlying SyncPrefectClient instance for direct Prefect API access.

wait_for_flow_run

Poll a flow run until it reaches a terminal state. Args:
  • flow_run_id: The ID of the flow run to wait for.
  • poll_interval: Seconds between polling attempts. Defaults to 5.0.
  • timeout: Maximum seconds to wait before raising an error. Defaults to None (wait forever).
  • raise_on_flow_failure: If True, raise FlowsError on flow failure. If False, return the flow run instead. Defaults to True.
Returns:
  • The flow run in its terminal state.
Raises:
  • FlowsError: If the flow run fails, crashes, or is cancelled (only when raise_on_flow_failure=True).
Examples: