Skip to content

trulens.core.run

trulens.core.run

Classes

Run

Bases: BaseModel

Attributes
model_config class-attribute
model_config: ConfigDict = ConfigDict(
    arbitrary_types_allowed=True, extra="ignore"
)

Run class for managing run state / attributes in the SDK client.

This model is meant to be used and accessed through methods like describe() (which uses the underlying RunDao) to obtain the run metadata.

Functions
describe
describe() -> Run

Retrieve the metadata of the Run object.

delete
delete() -> None

Delete the run by its name and object name.

start
start(input_df: Optional[DataFrame] = None)

Start the run by invoking the main method of the user's app with the input data

PARAMETER DESCRIPTION
input_df

user provided input dataframe.

TYPE: Optional[DataFrame] DEFAULT: None

update
update(
    description: Optional[str] = None,
    label: Optional[str] = None,
)

Only description and label are allowed to be updated at the moment.

from_metadata_df classmethod
from_metadata_df(
    metadata_df: DataFrame, extra: Dict[str, Any]
) -> Run

Create a Run instance from a metadata DataFrame returned by the DAO, and enrich it with additional fields (which are not persisted on the server).

PARAMETER DESCRIPTION
metadata_df

A pandas DataFrame containing run metadata. We assume the first row contains a JSON string in its first cell.

TYPE: DataFrame

extra

A dictionary of extra fields to add, such as: { "app": , "main_method_name": , "run_dao": , "object_name": , "object_type": }

TYPE: Dict[str, Any]

RETURNS DESCRIPTION
Run

A validated Run instance.

Functions

validate_dataset_spec

validate_dataset_spec(
    dataset_spec: Dict[str, str]
) -> Dict[str, str]

Validates and normalizes the dataset column specification to ensure it contains only valid fields and allows for subscripted fields like input_1, input_2, etc.

PARAMETER DESCRIPTION
dataset_spec

The user-provided dictionary with column names.

TYPE: Dict[str, str]

RETURNS DESCRIPTION
Dict[str, str]

A validated and normalized dictionary.

RAISES DESCRIPTION
ValueError

If any invalid field is present.