dacapo.store.config_store
Exceptions
Exception raised when trying to store a config with a name that already |
Classes
Base class for configuration stores. |
Module Contents
- exception dacapo.store.config_store.DuplicateNameError
Exception raised when trying to store a config with a name that already exists.
- message
The error message.
- Type:
str
- __str__()
Return the error message.
- class dacapo.store.config_store.ConfigStore
Base class for configuration stores.
- runs
The runs store.
- Type:
Any
- datasplits
The datasplits store.
- Type:
Any
- datasets
The datasets store.
- Type:
Any
- arrays
The arrays store.
- Type:
Any
- tasks
The tasks store.
- Type:
Any
- trainers
The trainers store.
- Type:
Any
- architectures
The architectures store.
- Type:
Any
- delete_config()
Delete a config from a store.
- store_run_config()
Store a run config.
- retrieve_run_config()
Retrieve a run config from a run name.
- retrieve_run_config_names()
Retrieve all run config names.
- delete_run_config()
Delete a run config.
- store_task_config()
Store a task config.
- retrieve_task_config()
Retrieve a task config from a task name.
- retrieve_task_config_names()
Retrieve all task config names.
- delete_task_config()
Delete a task config.
- store_architecture_config()
Store a architecture config.
- retrieve_architecture_config()
Retrieve a architecture config from a architecture name.
- retrieve_architecture_config_names()
Retrieve all architecture config names.
- delete_architecture_config()
Delete a architecture config.
- store_trainer_config()
Store a trainer config.
- retrieve_trainer_config()
Retrieve a trainer config from a trainer name.
- retrieve_trainer_config_names()
Retrieve all trainer config names.
- delete_trainer_config()
Delete a trainer config.
- store_datasplit_config()
Store a datasplit config.
- retrieve_datasplit_config()
Retrieve a datasplit config from a datasplit name.
- retrieve_datasplit_config_names()
Retrieve all datasplit names.
- delete_datasplit_config()
Delete a datasplit config.
- store_array_config()
Store a array config.
- retrieve_array_config()
Retrieve a array config from a array name.
- retrieve_array_config_names()
Retrieve all array names.
- delete_array_config()
Delete a array config.
Note
This class is an abstract base class for configuration stores. It defines the interface for storing and retrieving configuration objects (e.g., run, task, architecture, trainer, datasplit, dataset, array configs). Concrete implementations of this class should define how these objects are stored and retrieved (e.g., in a database, in files).
- runs: Any
- datasplits: Any
- datasets: Any
- arrays: Any
- tasks: Any
- trainers: Any
- architectures: Any
- abstract delete_config(database, config_name: str) None
Delete a config from a store.
- Parameters:
database (Any) – The store to delete the config from.
config_name (str) – The name of the config to delete.
- Raises:
KeyError – If the config does not exist.
Examples
>>> store.delete_config(store.runs, "run1")
- abstract store_run_config(run_config: dacapo.experiments.run_config.RunConfig) None
Store a run config. This should also store the configs that are part of the run config (i.e., task, architecture, trainer, and dataset config).
- Parameters:
run_config (RunConfig) – The run config to store.
- Raises:
DuplicateNameError – If a run config with the same name already exists.
Examples
>>> store.store_run_config(run_config)
- abstract retrieve_run_config(run_name: str) dacapo.experiments.run_config.RunConfig
Retrieve a run config from a run name.
- Parameters:
run_name (str) – The name of the run config to retrieve.
- Returns:
The run config with the given name.
- Return type:
- Raises:
KeyError – If the run config does not exist.
Examples
>>> run_config = store.retrieve_run_config("run1")
- abstract retrieve_run_config_names() List[str]
Retrieve all run config names.
- Returns:
The names of all run configs.
- Return type:
List[str]
- Raises:
KeyError – If no run configs exist.
Examples
>>> run_names = store.retrieve_run_config_names()
- delete_run_config(run_name: str) None
Delete a run config from the store.
- Parameters:
run_name (str) – The name of the run config to delete.
- Raises:
KeyError – If the run config does not exist.
Examples
>>> store.delete_run_config("run1")
- abstract store_task_config(task_config: dacapo.experiments.tasks.task_config.TaskConfig) None
Store a task config.
- Parameters:
task_config (TaskConfig) – The task config to store.
- Raises:
DuplicateNameError – If a task config with the same name already exists.
Examples
>>> store.store_task_config(task_config)
- abstract retrieve_task_config(task_name: str) dacapo.experiments.tasks.task_config.TaskConfig
Retrieve a task config from a task name.
- Parameters:
task_name (str) – The name of the task config to retrieve.
- Returns:
The task config with the given name.
- Return type:
- Raises:
KeyError – If the task config does not exist.
Examples
>>> task_config = store.retrieve_task_config("task1")
- abstract retrieve_task_config_names() List[str]
Retrieve all task config names.
- Parameters:
List[str] – The names of all task configs.
- Returns:
The names of all task configs.
- Return type:
List[str]
- Raises:
KeyError – If no task configs exist.
Examples
>>> task_names = store.retrieve_task_config_names()
- delete_task_config(task_name: str) None
Delete a task config from the store.
- Parameters:
task_name (str) – The name of the task config to delete.
- Raises:
KeyError – If the task config does not exist.
Examples
>>> store.delete_task_config("task1")
- abstract store_architecture_config(architecture_config: dacapo.experiments.architectures.architecture_config.ArchitectureConfig) None
Store a architecture config.
- Parameters:
architecture_config (ArchitectureConfig) – The architecture config to store.
- Raises:
DuplicateNameError – If a architecture config with the same name already exists.
Examples
>>> store.store_architecture_config(architecture_config)
- abstract retrieve_architecture_config(architecture_name: str) dacapo.experiments.architectures.architecture_config.ArchitectureConfig
Retrieve a architecture config from a architecture name.
- Parameters:
architecture_name (str) – The name of the architecture config to retrieve.
- Returns:
The architecture config with the given name.
- Return type:
- Raises:
KeyError – If the architecture config does not exist.
Examples
>>> architecture_config = store.retrieve_architecture_config("architecture1")
- abstract retrieve_architecture_config_names() List[str]
Retrieve all architecture config names.
- Parameters:
List[str] – The names of all architecture configs.
- Returns:
The names of all architecture configs.
- Return type:
List[str]
- Raises:
KeyError – If no architecture configs exist.
Examples
>>> architecture_names = store.retrieve_architecture_config_names()
- delete_architecture_config(architecture_name: str) None
Delete a architecture config from the store.
- Parameters:
architecture_name (str) – The name of the architecture config to delete.
- Raises:
KeyError – If the architecture config does not exist.
Examples
>>> store.delete_architecture_config("architecture1")
- abstract store_trainer_config(trainer_config: dacapo.experiments.trainers.trainer_config.TrainerConfig) None
Store a trainer config.
- Parameters:
trainer_config (TrainerConfig) – The trainer config to store.
- Raises:
DuplicateNameError – If a trainer config with the same name already exists.
Examples
>>> store.store_trainer_config(trainer_config)
- abstract retrieve_trainer_config(trainer_name: str) None
Retrieve a trainer config from a trainer name.
- Parameters:
trainer_name (str) – The name of the trainer config to retrieve.
- Returns:
The trainer config with the given name.
- Return type:
- Raises:
KeyError – If the trainer config does not exist.
Examples
>>> trainer_config = store.retrieve_trainer_config("trainer1")
- abstract retrieve_trainer_config_names() List[str]
Retrieve all trainer config names.
- Parameters:
List[str] – The names of all trainer configs.
- Returns:
The names of all trainer configs.
- Return type:
List[str]
- Raises:
KeyError – If no trainer configs exist.
Examples
>>> trainer_names = store.retrieve_trainer_config_names()
- delete_trainer_config(trainer_name: str) None
Delete a trainer config from the store.
- Parameters:
trainer_name (str) – The name of the trainer config to delete.
- Raises:
KeyError – If the trainer config does not exist.
Examples
>>> store.delete_trainer_config("trainer1")
- abstract store_datasplit_config(datasplit_config: dacapo.experiments.datasplits.datasplit_config.DataSplitConfig) None
Store a datasplit config.
- Parameters:
datasplit_config (DataSplitConfig) – The datasplit config to store.
- Raises:
DuplicateNameError – If a datasplit config with the same name already exists.
Examples
>>> store.store_datasplit_config(datasplit_config)
- abstract retrieve_datasplit_config(datasplit_name: str) dacapo.experiments.datasplits.datasplit_config.DataSplitConfig
Retrieve a datasplit config from a datasplit name.
- Parameters:
datasplit_name (str) – The name of the datasplit config to retrieve.
- Returns:
The datasplit config with the given name.
- Return type:
- Raises:
KeyError – If the datasplit config does not exist.
Examples
>>> datasplit_config = store.retrieve_datasplit_config("datasplit1")
- abstract retrieve_datasplit_config_names() List[str]
Retrieve all datasplit names.
- Parameters:
List[str] – The names of all datasplit configs.
- Returns:
The names of all datasplit configs.
- Return type:
List[str]
- Raises:
KeyError – If no datasplit configs exist.
Examples
>>> datasplit_names = store.retrieve_datasplit_config_names()
- abstract store_array_config(array_config: dacapo.experiments.datasplits.datasets.arrays.array_config.ArrayConfig) None
Store a array config.
- Parameters:
array_config (ArrayConfig) – The array config to store.
- Raises:
DuplicateNameError – If a array config with the same name already exists.
Examples
>>> store.store_array_config(array_config)
- abstract retrieve_array_config(array_name: str) dacapo.experiments.datasplits.datasets.arrays.array_config.ArrayConfig
Retrieve a array config from a array name.
- Parameters:
array_name (str) – The name of the array config to retrieve.
- Returns:
The array config with the given name.
- Return type:
- Raises:
KeyError – If the array config does not exist.
Examples
>>> array_config = store.retrieve_array_config("array1")
- abstract retrieve_array_config_names() List[str]
Retrieve all array names.
- Parameters:
List[str] – The names of all array configs.
- Returns:
The names of all array configs.
- Return type:
List[str]
- Raises:
KeyError – If no array configs exist.
Examples
>>> array_names = store.retrieve_array_config_names()