Skip to content

storagehandler

storagehandler

Handles multiple storages for the dashboard

Classes

StorageHandler

StorageHandler(storages)

Handles multiple storages for the dashboard

Source code in niceml/data/storages/storagehandler.py
def __init__(self, storages: Dict[str, StorageInterface]):
    self.storages = storages
Functions
get_storage
get_storage(name)

Returns the storage with the given name

Source code in niceml/data/storages/storagehandler.py
def get_storage(self, name: str) -> StorageInterface:
    """Returns the storage with the given name"""
    try:
        return self.storages[name]
    except KeyError as error:
        raise StorageNotAvailableError(
            f"Storage with name: {name} not available!"
        ) from error
get_storage_names
get_storage_names()

Returns a list of all storage names

Source code in niceml/data/storages/storagehandler.py
def get_storage_names(self) -> List[str]:
    """Returns a list of all storage names"""
    return list(self.storages.keys())

StorageNotAvailableError

Bases: Exception

Error when the name of the storage is not declared