LocalFileStorage

class openff.evaluator.storage.LocalFileStorage(root_directory='stored_data')[source]

A storage backend which stores files in directories on the local disk.

__init__(root_directory='stored_data')[source]

Constructs a new StorageBackend object.

Methods

__init__([root_directory])

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.

Attributes

root_directory

Returns the directory in which all stored objects are located.

property root_directory

Returns the directory in which all stored objects are located.

Type

str

has_force_field(force_field)

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

has_object(storage_object)

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

query(data_query)

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

retrieve_force_field(storage_key)

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

retrieve_object(storage_key, expected_type=None)

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.

store_force_field(force_field)

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

store_object(object_to_store, ancillary_data_path=None)

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