schrodinger.application.models.library.library module¶
- class schrodinger.application.models.library.library.Library(client: AbstractLibraryClient)¶
Bases:
objectHigh-level library API providing composite operations and access to model trees for querying and validation.
- __init__(client: AbstractLibraryClient)¶
Initialize the library with a client for CRUD operations.
- Parameters:
client – The library client for CRUD operations
- getAllExecutionRecords() list[ExecutionRecord]¶
Get all execution records in the library.
- Returns:
List of all execution records
- getModelTree(model_def: ModelDefinition) ModelTree¶
Get the ModelTree for a given model definition.
- Parameters:
model_def – The model definition
- Returns:
The corresponding ModelTree
- Raises:
ValueError – If no ModelTree is found for the definition
- getDefinitions() list[ModelDefinition]¶
List all model definitions in the library.
- Returns:
List of all model definitions
- refresh() None¶
- getDefinitionVersions(def_id: str) list[ModelDefinition]¶
Get all versions of a definition.
- Parameters:
def_id – The definition ID
- Returns:
List of all versions of the definition
- getConfigurationVersions(config_id: str) list[ModelConfiguration]¶
Get all versions of a configuration.
- Parameters:
config_id – The configuration ID
- Returns:
List of all versions of the configuration
- recordModelExecution(composite_model: CompositeModel, start_time: datetime, end_time: datetime) ExecutionRecord¶
Record execution of a composite model.
Creates an execution record with metadata from the composite model and timestamps, then stores it in the library.
- Parameters:
composite_model – The executed composite model
start_time – When execution started
end_time – When execution ended
- Returns:
The created execution record
- Raises:
ValueError – If start_time is after end_time
ExecutionRecordExistsError – If a record with the same ID already exists
- createDefinition(model_def: ModelDefinition) ModelDefinition¶
Create a new definition in the library.
- Parameters:
model_def – The model definition to create
- Returns:
The created definition
- Raises:
ModelExistsError – If a definition with the same ID and version already exists
- updateDefinition(model_def: ModelDefinition) ModelDefinition¶
Update an existing definition in the library.
- Parameters:
model_def – The model definition to update
- Returns:
The updated definition
- Raises:
ModelNotFoundError – If the definition ID is not found
- createConfiguration(model_config: ModelConfiguration) ModelConfiguration¶
Create a new configuration in the library.
- Parameters:
model_config – The model configuration to create
- Returns:
The created configuration
- Raises:
ModelExistsError – If a configuration with the same ID and version already exists
- updateConfiguration(model_config: ModelConfiguration) ModelConfiguration¶
Update an existing configuration in the library.
- Parameters:
model_config – The model configuration to update
- Returns:
The updated configuration
- Raises:
ModelNotFoundError – If the configuration ID is not found
UpdateVersionError – If the new version is less than the current highest version
- createExecutionRecord(record: ExecutionRecord) ExecutionRecord¶
Create a new execution record in the library.
- Parameters:
record – The execution record to create
- Returns:
The created execution record
- Raises:
ExecutionRecordExistsError – If a record with the same ID already exists
- getExecutionRecord(record_id: str) ExecutionRecord¶
Get an execution record from the library.
- Parameters:
record_id – The execution record ID
- Returns:
The execution record
- Raises:
ExecutionRecordNotFoundError – If the record is not found
- getCurrentUser() str¶
Get the current user’s username.
- Returns:
The current user’s username
- getAllExecutionRecordIds() list[str]¶
Get all execution record IDs in the library.