Skip to content

sift_client.resources.runs

CLASS DESCRIPTION
RunsAPIAsync

High-level API for interacting with runs.

RunsAPIAsync

RunsAPIAsync(sift_client: SiftClient)

Bases: ResourceBase

High-level API for interacting with runs.

This class provides a Pythonic, notebook-friendly interface for interacting with the RunsAPI. It handles automatic handling of gRPC services, seamless type conversion, and clear error handling.

All methods in this class use the Run class from the low-level wrapper, which is a user-friendly representation of a run using standard Python data structures and types.

Initialize the RunsAPI.

PARAMETER DESCRIPTION
sift_client

The Sift client to use.

TYPE: SiftClient

METHOD DESCRIPTION
archive

Archive a run.

create

Create a new run.

find

Find a single run matching the given query. Takes the same arguments as list_. If more than one run is found,

get

Get a Run.

list_

List runs with optional filtering.

stop

Stop a run by setting its stop time to the current time.

unarchive

Unarchive a run.

update

Update a Run.

ATTRIBUTE DESCRIPTION
client

TYPE: SiftClient

grpc_client

TYPE: GrpcClient

rest_client

TYPE: RestClient

client property

client: SiftClient

grpc_client property

grpc_client: GrpcClient

rest_client property

rest_client: RestClient

archive async

archive(run: str | Run) -> Run

Archive a run.

PARAMETER DESCRIPTION
run

The Run or run ID to archive.

TYPE: str | Run

create async

create(
    create: RunCreate | dict,
    assets: list[str | Asset] | None = None,
    associate_new_data: bool = False,
) -> Run

Create a new run.

Note on assets: You do not need to provide asset info when creating a run. If you pass a Run to future ingestion configs associated with assets, the association will happen automatically then. However, if you do pass assets and set associate_new_data=True, future ingested data that falls within the Run's time period will be associated with the Run. Even if that data's timestamp is in the past, if it has not been ingested yet and the Run's timestamp envelopes it, it will be associated with the Run. This may be useful if you want to capture a time range for a specific asset or won't know about this Run when ingesting to that asset. If the data has already been ingested, leave associate_new_data=False.

PARAMETER DESCRIPTION
create

The Run definition to create.

TYPE: RunCreate | dict

assets

List of assets to associate with the run. Note: if you are associating new data, you must provide assets/asset names.

TYPE: list[str | Asset] | None DEFAULT: None

associate_new_data

If True, future ingested data that falls within the Run's time period will be associated with the Run. Even if that data's timestamp is in the past, if it has not been ingested yet and the Run's timestamp envelopes it, it will be associated with the Run.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
Run

The created Run.

find async

find(**kwargs) -> Run | None

Find a single run matching the given query. Takes the same arguments as list_. If more than one run is found, raises an error.

PARAMETER DESCRIPTION
**kwargs

Keyword arguments to pass to list_.

DEFAULT: {}

RETURNS DESCRIPTION
Run | None

The Run found or None.

get async

get(
    *,
    run_id: str | None = None,
    client_key: str | None = None,
) -> Run

Get a Run.

PARAMETER DESCRIPTION
run_id

The ID of the run.

TYPE: str | None DEFAULT: None

client_key

The client key of the run.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
Run

The Run.

list_ async

list_(
    *,
    name: str | None = None,
    names: list[str] | None = None,
    name_contains: str | None = None,
    name_regex: str | Pattern | None = None,
    run_ids: list[str] | None = None,
    client_keys: list[str] | None = None,
    created_after: datetime | None = None,
    created_before: datetime | None = None,
    modified_after: datetime | None = None,
    modified_before: datetime | None = None,
    created_by: Any | str | None = None,
    modified_by: Any | str | None = None,
    tags: list[str | Tag] | None = None,
    metadata: list[Any] | None = None,
    assets: list[Asset] | list[str] | None = None,
    asset_tags: list[str | Tag] | None = None,
    duration_less_than: timedelta | None = None,
    duration_greater_than: timedelta | None = None,
    start_time_after: datetime | None = None,
    start_time_before: datetime | None = None,
    stop_time_after: datetime | None = None,
    stop_time_before: datetime | None = None,
    is_stopped: bool | None = None,
    description_contains: str | None = None,
    include_archived: bool = False,
    filter_query: str | None = None,
    order_by: str | None = None,
    limit: int | None = None,
) -> list[Run]

List runs with optional filtering.

PARAMETER DESCRIPTION
name

Exact name of the run.

TYPE: str | None DEFAULT: None

names

List of run names to filter by.

TYPE: list[str] | None DEFAULT: None

name_contains

Partial name of the run.

TYPE: str | None DEFAULT: None

name_regex

Regular expression to filter runs by name.

TYPE: str | Pattern | None DEFAULT: None

run_ids

Filter to runs with any of these IDs.

TYPE: list[str] | None DEFAULT: None

client_keys

Filter to runs with any of these client keys.

TYPE: list[str] | None DEFAULT: None

created_after

Filter runs created after this datetime.

TYPE: datetime | None DEFAULT: None

created_before

Filter runs created before this datetime.

TYPE: datetime | None DEFAULT: None

modified_after

Filter runs modified after this datetime.

TYPE: datetime | None DEFAULT: None

modified_before

Filter runs modified before this datetime.

TYPE: datetime | None DEFAULT: None

created_by

Filter runs created by this User or user ID.

TYPE: Any | str | None DEFAULT: None

modified_by

Filter runs last modified by this User or user ID.

TYPE: Any | str | None DEFAULT: None

tags

Filter runs with any of these Tags IDs.

TYPE: list[str | Tag] | None DEFAULT: None

metadata

Filter runs by metadata criteria.

TYPE: list[Any] | None DEFAULT: None

assets

Filter runs associated with any of these Assets or asset IDs.

TYPE: list[Asset] | list[str] | None DEFAULT: None

asset_tags

Filter runs associated with any Assets that have these Tag IDs.

TYPE: list[str | Tag] | None DEFAULT: None

duration_less_than

Filter runs with duration less than this time.

TYPE: timedelta | None DEFAULT: None

duration_greater_than

Filter runs with duration greater than this time.

TYPE: timedelta | None DEFAULT: None

start_time_after

Filter runs that started after this datetime.

TYPE: datetime | None DEFAULT: None

start_time_before

Filter runs that started before this datetime.

TYPE: datetime | None DEFAULT: None

stop_time_after

Filter runs that stopped after this datetime.

TYPE: datetime | None DEFAULT: None

stop_time_before

Filter runs that stopped before this datetime.

TYPE: datetime | None DEFAULT: None

is_stopped

Whether the run is stopped.

TYPE: bool | None DEFAULT: None

description_contains

Partial description of the run.

TYPE: str | None DEFAULT: None

include_archived

If True, include archived runs in results.

TYPE: bool DEFAULT: False

filter_query

Explicit CEL query to filter runs.

TYPE: str | None DEFAULT: None

order_by

Field and direction to order results by.

TYPE: str | None DEFAULT: None

limit

Maximum number of runs to return. If None, returns all matches.

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
list[Run]

A list of Run objects that match the filter criteria.

stop async

stop(run: str | Run) -> Run

Stop a run by setting its stop time to the current time.

PARAMETER DESCRIPTION
run

The Run or run ID to stop.

TYPE: str | Run

unarchive async

unarchive(run: str | Run) -> Run

Unarchive a run.

PARAMETER DESCRIPTION
run

The Run or run ID to unarchive.

TYPE: str | Run

update async

update(run: str | Run, update: RunUpdate | dict) -> Run

Update a Run.

PARAMETER DESCRIPTION
run

The Run or run ID to update.

TYPE: str | Run

update

Updates to apply to the Run.

TYPE: RunUpdate | dict

RETURNS DESCRIPTION
Run

The updated Run.