StorageBackend

class openff.evaluator.storage.StorageBackend[source]

An abstract base representation of how the openff-evaluator will interact with and store simulation data.

Notes

When implementing this class, only private methods should be overridden as the public methods only mainly implement thread locks, while their private version perform their actual function.

__init__()[source]

Constructs a new StorageBackend object.

Methods

__init__()

Constructs a new StorageBackend object.

has_force_field(force_field)

A convenience method for checking whether the specified ForceFieldSource object is stored in the backend.

has_object(storage_object)

Checks whether a given hashable object exists in the storage system.

query(data_query)

Query the storage backend for data matching the query criteria.

retrieve_force_field(storage_key)

A convenience method for retrieving ForceFieldSource objects.

retrieve_object(storage_key[, expected_type])

Retrieves a stored object for the estimators storage system.

store_force_field(force_field)

A convenience method for storing ForceFieldSource objects.

store_object(object_to_store[, ...])

Store an object in the storage system, returning the key of the stored object.

store_object(object_to_store, ancillary_data_path=None)[source]

Store an object in the storage system, returning the key of the stored object. This may be different to storage_key depending on whether the same or a similar object was already present in the system.

Parameters
  • object_to_store (BaseStoredData) – The object to store.

  • ancillary_data_path (str, optional) – The data path to the ancillary directory-like data to store alongside the object if the data type requires one.

Returns

The unique key assigned to the stored object.

Return type

str

store_force_field(force_field)[source]

A convenience method for storing ForceFieldSource objects.

Parameters

force_field (ForceFieldSource) – The force field to store.

Returns

The unique id of the stored force field.

Return type

str

retrieve_object(storage_key, expected_type=None)[source]

Retrieves a stored object for the estimators storage system.

Parameters
  • storage_key (str) – A unique key that describes where the stored object can be found within the storage system.

  • expected_type (type of BaseStoredData, optional) – The expected data type. An exception is raised if the retrieved data doesn’t match the type.

Returns

  • BaseStoredData, optional – The stored object if the object key is found, otherwise None.

  • str, optional – The path to the ancillary data if present.

retrieve_force_field(storage_key)[source]

A convenience method for retrieving ForceFieldSource objects.

Parameters

storage_key (str) – The key of the force field to retrieve.

Returns

The retrieved force field source.

Return type

ForceFieldSource

has_object(storage_object)[source]

Checks whether a given hashable object exists in the storage system.

Parameters

storage_object (BaseStoredData) – The object to check for.

Returns

The unique key of the object if it is in the system, None otherwise.

Return type

str, optional

has_force_field(force_field)[source]

A convenience method for checking whether the specified ForceFieldSource object is stored in the backend.

Parameters

force_field (ForceFieldSource) – The force field to look for.

Returns

The unique key of the object if it is in the system, None otherwise.

Return type

str, optional

query(data_query)[source]

Query the storage backend for data matching the query criteria.

Parameters

data_query (BaseDataQuery) – The query to perform.

Returns

The data that matches the query partitioned by the matched values. The list values take the form (storage_key, data_object, data_directory_path).

Return type

dict of tuple and list of tuple of str, BaseStoredData and str