schrodinger.application.models.library.abstract_library module¶
- exception schrodinger.application.models.library.abstract_library.ModelExistsError(id: str, version: int, is_definition: bool = True)¶
Bases:
ExceptionRaised when trying to upload a model definition or configuration that already exists in the library.
- __init__(id: str, version: int, is_definition: bool = True) None¶
- exception schrodinger.application.models.library.abstract_library.ModelNotFoundError(id: str, version: int | None = None, is_definition: bool = True)¶
Bases:
ExceptionRaised when trying to download a model definition or configuration that does not exist in the library.
- __init__(id: str, version: int | None = None, is_definition: bool = True) None¶
- exception schrodinger.application.models.library.abstract_library.UpdateVersionError(id: str, new_version: int, current_highest_version: int, is_definition: bool = True)¶
Bases:
ExceptionRaised when trying to update a model definition to a lower version
- __init__(id: str, new_version: int, current_highest_version: int, is_definition: bool = True) None¶
- exception schrodinger.application.models.library.abstract_library.ExecutionRecordExistsError(record_id: str)¶
Bases:
ExceptionRaised when trying to upload an execution record that already exists in the library.
- __init__(record_id: str) None¶
- exception schrodinger.application.models.library.abstract_library.ExecutionRecordNotFoundError(record_id: str)¶
Bases:
ExceptionRaised when trying to download an execution record that does not exist in the library.
- __init__(record_id: str) None¶
- class schrodinger.application.models.library.abstract_library.AbstractModelLibrary¶
Bases:
objectAbstract base class for model libraries.
Defines the core interface that all library implementations must support for CRUD operations.
- createDefinition(model_def: ModelDefinition) ModelDefinition¶
Add a model definition to the library and return the added definition.
- Parameters:
model_def – The model definition to upload
- Raises:
ModelExistsError – If a definition with the same ID and version already exists
- getDefinition(def_id: str, version: int | None = None) ModelDefinition¶
Read and return a model definition from the library.
- Parameters:
def_id – The definition ID to download
version – The specific version to download, or None for latest
- Returns:
The model definition
- Raises:
ModelNotFoundError – If the definition is not found
- updateDefinition(model_def: ModelDefinition) ModelDefinition¶
Update an existing model definition in the library and return the updated definition.
- Parameters:
model_def – The model definition to update
- Raises:
ModelNotFoundError – If the definition ID is not found
UpdateVersionError – If the new version is less than the current highest version
- createConfiguration(model_config: ModelConfiguration) ModelConfiguration¶
Add a model.config to the library and return the added configuration.
- Parameters:
model_config – The model.config to upload
- Raises:
ModelExistsError – If an configuration with the same ID and version already exists
- getConfiguration(config_id: str, version: int | None = None) ModelConfiguration¶
Read and return a model.config from the library.
- Parameters:
config_id – The configuration ID to download
version – The specific version to download, or None for latest
- Returns:
The model.config
- Raises:
ModelNotFoundError – If the configuration is not found
- getAllDefinitionIds() list[str]¶
Get all definition IDs in the library.
- Returns:
List of unique definition IDs
- getAllConfigurationIds() list[str]¶
Get all configuration IDs in the library.
- Returns:
List of unique configuration IDs
- getDefinitionVersions(def_id: str) list[int]¶
Get all available versions for a definition ID.
- Parameters:
def_id – The definition ID
- Returns:
List of version numbers, sorted in ascending order
- Raises:
ModelNotFoundError – If the definition ID is not found
- getConfigurationVersions(config_id: str) list[int]¶
Get all available versions for an configuration ID.
- Parameters:
config_id – The configuration ID
- Returns:
List of version numbers, sorted in ascending order
- Raises:
ModelNotFoundError – If the configuration ID is not found
- createExecutionRecord(record: ExecutionRecord) ExecutionRecord¶
Add an execution record to the library and return the added record.
- Parameters:
record – The execution record to upload
- Raises:
ExecutionRecordExistsError – If a record with the same ID already exists
- getExecutionRecord(record_id: str) ExecutionRecord¶
Read and return the specified execution record.
- Parameters:
record_id – The ID of the execution record to download
- Raises:
ExecutionRecordNotFoundError – If the record is not found
- getAllExecutionRecordIds() list[str]¶
Get all execution record IDs in the library.
- Returns:
List of unique execution record IDs
- getCurrentUser() str¶
Return the username of the current user.
- getDefinitions(def_ids: list[str], version: int | None = None) list[ModelDefinition]¶
Get multiple model definitions from the library.
- Parameters:
def_ids – List of definition IDs to download
version – The specific version to download for all definitions, or None for latest
- Returns:
List of model definitions in the same order as def_ids
- Raises:
ModelNotFoundError – If any definition is not found
- getConfigurations(config_ids: list[str], version: int | None = None) list[ModelConfiguration]¶
Get multiple model.configs from the library.
- Parameters:
config_ids – List of configuration IDs to download
version – The specific version to download for all configurations, or None for latest
- Returns:
List of model.configs in the same order as config_ids
- Raises:
ModelNotFoundError – If any configuration is not found
- loadCompositeModel(config_id: str, version: int = None) CompositeModel¶
Load a CompositeModel from an configuration ID.
Downloads the model.config and its definition from the library, builds the inheritance chain, and creates a populated CompositeModel.
- Parameters:
config_id – The ID of the model.config to load
version – The version of the model.config (None for latest)
- Returns:
A populated CompositeModel ready for execution
- Raises:
ModelNotFoundError – If any configuration in the configuration chain can’t be found or if the definition isn’t found.
- buildConfigurationChain(model_config: ModelConfiguration) list[ModelConfiguration]¶
Build the inheritance chain for a model.config.
Returns the chain of parent configs starting with the root config and ending with the supplied config.
- Parameters:
model_config – The model.config to build the chain for
- Returns:
List of model.configs from root to the given config
- recordModelExecution(composite_model: CompositeModel, start_time: datetime, end_time: datetime) ExecutionRecord¶
Create, upload, and return a record of the current model.config being run.
- Raises:
ExecutionRecordExistsError – If a record with the same ID already exists.