class openfe.storage.FileSystemWarehouse(root_dir: Path, exist_ok=False)#

Warehouse implementation using local filesystem storage.

Provides a file-based storage backend for GufeTokenizable objects organized in a directory structure.

Warning

Warehouse storage is an experimental feature and subject to change in future releases of openfe

Parameters:

root_dir (pathlib.Path, optional) – Root directory in which to create the warehouse storage.

classmethod from_dir(root_dir: Path) → FileSystemWarehouse#

Initialize a FileSystemWarehouse from an existing directory.

Parameters:

root_dir (pathlib.Path) – Root directory of the Warehouse.

Return type:

FileSystemWarehouse

Raises:

FileNotFoundError – If root_dir is not an existing directory.

delete(store_name: Literal['setup', 'results'], location: str)#

Delete an object from a specific store.

Parameters:
  • store_name (Literal["setup", "results"]) – Name of the store to delete from.

  • location (str) – Location/path of the object to delete.

Raises:

MissingExternalResourceError – Thrown if the object you are trying to delete, can’t delete from the store

exists(key: GufeKey) → bool#

Check if an object with the given key exists in any store that holds tokenizables.

Parameters:

key (GufeKey) – The key to check for existence.

Returns:

True if the object exists, False otherwise.

Return type:

bool

gather_all_results() → list[tuple[ProtocolResult, ProtocolDAGResult]]#

From this warehouse, gather all ProtocolDAGResults corresponding to the recorded ProtocolDAGs, and return all (ProtocolResult, ProtocolDAGResult) pairs.

Note: this requires the Warehouse to explicitly have stored the ProtocolDAGs and their ProtocolUnits when constructing the task graph.

Returns:

ProtocolResults and their corresponding ProtocolDAGResults

Return type:

list[tuple[ProtocolResult, ProtocolDAGResult]]

get_protocol_dags() → Generator[ProtocolDAG, None, None]#

Yield the protocol dags present in the Warehouse’s ‘protocol_dags’ store.

Note that this requires the name of the item to start with ‘ProtocolDAG’.

Yields:

Generator[ProtocolDAG] – The ProtocolDAGs found in this Warehouse’s ‘protocol_dags’ store.

get_unit_results() → Generator[ProtocolUnitResult, None, None]#

Yield all ProtocolUnitResult(s) stored in the Warehouse’s ‘result’ store.

Yields:

Generator[ProtocolUnitResult] – The ProtocolUnitResults found in this Warehouse’s ‘result’ store

Raises:

RuntimeError – If any object in the result store is not a ProtocolUnitResult.

load_protocol_dag(gufe_key=<class 'gufe.tokenization.GufeKey'>) → GufeTokenizable#

Load a GufeTokenizable object from the protocol_dag store.

Parameters:

obj (GufeKey) – The key of the protocoldag to load.

Returns:

The loaded object.

Return type:

GufeTokenizable

Raises:

TypeError – If gufe_key does not corresponds to an object that is not a ProtocolDAG instance.

load_results_tokenizable(obj: GufeKey) → GufeTokenizable#

Load a GufeTokenizable object from the result store.

Parameters:

obj (GufeKey) – The key of the object to load.

Returns:

The loaded object.

Return type:

GufeTokenizable

load_setup_tokenizable(obj: GufeKey) → GufeTokenizable#

Load a GufeTokenizable object from the setup store.

Parameters:

obj (GufeKey) – The key of the object to load.

Returns:

The loaded object.

Return type:

GufeTokenizable

load_task(obj: GufeKey) → ProtocolUnit#
property result_store#

Get the result store.

Returns:

The result storage location

Return type:

ExternalStorage

property setup_store#

Get the setup store

Returns:

The setup storage location

Return type:

ExternalStorage

property shared_store#

Get the shared store.

Returns:

The shared storage location

Return type:

ExternalStorage

store_protocol_dag(dag: ProtocolDAG)#

Store a ProtocolDAG in the “protocol_dags” store of this warehouse. :param dag: The ProtocolDAG object to store. :type dag: ProtocolDAG

Raises:

TypeError – If dag is not a ProtocolDAG instance.

store_results_tokenizable(obj: GufeTokenizable)#

Store a GufeTokenizable object to the results store.

Parameters:

obj (GufeKey) – The key of the object to store.

store_setup_tokenizable(obj: GufeTokenizable)#

Store a GufeTokenizable object in the setup store.

Parameters:

obj (GufeTokenizable) – The object to store.

store_task(obj: ProtocolUnit)#