dacapo.store.file_config_store
Attributes
Classes
A Local File based store for configurations. Used to store and retrieve |
Module Contents
- dacapo.store.file_config_store.logger
- class dacapo.store.file_config_store.FileConfigStore(path)
A Local File based store for configurations. Used to store and retrieve configurations for runs, tasks, architectures, trainers, and datasplits.
- path
The path to the file.
- Type:
Path
- store_run_config(run_config, ignore=None)
Stores the run configuration in the file config store.
- retrieve_run_config(run_name)
Retrieve the run configuration for a given run name.
- retrieve_run_config_names()
Retrieve the names of the run configurations.
- store_task_config(task_config, ignore=None)
Stores the task configuration in the file config store.
- retrieve_task_config(task_name)
Retrieve the task configuration for a given task name.
- retrieve_task_config_names()
Retrieve the names of the task configurations.
- store_architecture_config(architecture_config, ignore=None)
Stores the architecture configuration in the file config store.
- retrieve_architecture_config(architecture_name)
Retrieve the architecture configuration for a given architecture name.
- retrieve_architecture_config_names()
Retrieve the names of the architecture configurations.
- store_trainer_config(trainer_config, ignore=None)
Stores the trainer configuration in the file config store.
- retrieve_trainer_config(trainer_name)
Retrieve the trainer configuration for a given trainer name.
- retrieve_trainer_config_names()
Retrieve the names of the trainer configurations.
- store_datasplit_config(datasplit_config, ignore=None)
Stores the datasplit configuration in the file config store.
- retrieve_datasplit_config(datasplit_name)
Retrieve the datasplit configuration for a given datasplit name.
- retrieve_datasplit_config_names()
Retrieve the names of the datasplit configurations.
- store_array_config(array_config, ignore=None)
Stores the array configuration in the file config store.
- retrieve_array_config(array_name)
Retrieve the array configuration for a given array name.
- retrieve_array_config_names()
Retrieve the names of the array configurations.
- __save_insert(collection, data, ignore=None)
Saves the data to the collection.
- __load(collection, name)
Loads the data
Notes
The FileConfigStore is used to store and retrieve configurations for runs, tasks, architectures, trainers, and datasplits. The FileConfigStore is a local file based store for configurations.
- path
- store_run_config(run_config, ignore=None)
Stores the run configuration in the file config store.
- Parameters:
run_config (RunConfig) – The run configuration to store.
ignore (list, optional) – A list of keys to ignore when comparing the stored configuration with the new configuration. Defaults to None.
- Raises:
DuplicateNameError – If a configuration with the same name already exists.
Examples
>>> store.store_run_config(run_config)
- retrieve_run_config(run_name)
Retrieve the run configuration for a given run name.
- Parameters:
run_name (str) – The name of the run configuration to retrieve.
- Returns:
The run configuration object.
- Return type:
- Raises:
KeyError – If the run name does not exist in the store.
Examples
>>> run_config = store.retrieve_run_config("run1")
- retrieve_run_config_names()
Retrieve the names of the run configurations.
- Returns:
A list of run configuration names.
- Raises:
KeyError – If no run configurations are stored.
Examples
>>> run_names = store.retrieve_run_config_names()
- store_task_config(task_config, ignore=None)
Stores the task configuration in the file config store.
- Parameters:
task_config (TaskConfig) – The task configuration to store.
ignore (list, optional) – A list of keys to ignore when comparing the stored configuration with the new configuration. Defaults to None.
- Raises:
DuplicateNameError – If a configuration with the same name already exists.
Examples
>>> store.store_task_config(task_config)
- retrieve_task_config(task_name)
Retrieve the task configuration for a given task name.
- Parameters:
task_name (str) – The name of the task configuration to retrieve.
- Returns:
The task configuration object.
- Return type:
- Raises:
KeyError – If the task name does not exist in the store.
Examples
>>> task_config = store.retrieve_task_config("task1")
- retrieve_task_config_names()
Retrieve the names of the task configurations.
- Returns:
A list of task configuration names.
- Raises:
KeyError – If no task configurations are stored.
Examples
>>> task_names = store.retrieve_task_config_names()
- store_architecture_config(architecture_config, ignore=None)
Stores the architecture configuration in the file config store.
- Parameters:
architecture_config (ArchitectureConfig) – The architecture configuration to store.
ignore (list, optional) – A list of keys to ignore when comparing the stored configuration with the new configuration. Defaults to None.
- Raises:
DuplicateNameError – If a configuration with the same name already exists.
Examples
>>> store.store_architecture_config(architecture_config)
- retrieve_architecture_config(architecture_name)
Retrieve the architecture configuration for a given architecture name.
- Parameters:
architecture_name (str) – The name of the architecture configuration to retrieve.
- Returns:
The architecture configuration object.
- Return type:
- Raises:
KeyError – If the architecture name does not exist in the store.
Examples
>>> architecture_config = store.retrieve_architecture_config("architecture1")
- retrieve_architecture_config_names()
Retrieve the names of the architecture configurations.
- Returns:
A list of architecture configuration names.
- Raises:
KeyError – If no architecture configurations are stored.
Examples
>>> architecture_names = store.retrieve_architecture_config_names()
- store_trainer_config(trainer_config, ignore=None)
Stores the trainer configuration in the file config store.
- Parameters:
trainer_config (TrainerConfig) – The trainer configuration to store.
ignore (list, optional) – A list of keys to ignore when comparing the stored configuration with the new configuration. Defaults to None.
- Raises:
DuplicateNameError – If a configuration with the same name already exists.
Examples
>>> store.store_trainer_config(trainer_config)
- retrieve_trainer_config(trainer_name)
Retrieve the trainer configuration for a given trainer name.
- Parameters:
trainer_name (str) – The name of the trainer configuration to retrieve.
- Returns:
The trainer configuration object.
- Return type:
- Raises:
KeyError – If the trainer name does not exist in the store.
Examples
>>> trainer_config = store.retrieve_trainer_config("trainer1")
- retrieve_trainer_config_names()
Retrieve the names of the trainer configurations.
- Parameters:
trainer_name (str) – The name of the trainer configuration to retrieve.
- Returns:
The trainer configuration object.
- Return type:
- Raises:
KeyError – If the trainer name does not exist in the store.
Examples
>>> trainer_config = store.retrieve_trainer_config("trainer1")
- store_datasplit_config(datasplit_config, ignore=None)
Stores the datasplit configuration in the file config store.
- Parameters:
datasplit_config (DataSplitConfig) – The datasplit configuration to store.
ignore (list, optional) – A list of keys to ignore when comparing the stored configuration with the new configuration. Defaults to None.
- Raises:
DuplicateNameError – If a configuration with the same name already exists.
Examples
>>> store.store_datasplit_config(datasplit_config)
- retrieve_datasplit_config(datasplit_name)
Retrieve the datasplit configuration for a given datasplit name.
- Parameters:
datasplit_name (str) – The name of the datasplit configuration to retrieve.
- Returns:
The datasplit configuration object.
- Return type:
- Raises:
KeyError – If the datasplit name does not exist in the store.
Examples
>>> datasplit_config = store.retrieve_datasplit_config("datasplit1")
- retrieve_datasplit_config_names()
Retrieve the names of the datasplit configurations.
- Parameters:
datasplit_name (str) – The name of the datasplit configuration to retrieve.
- Returns:
The datasplit configuration object.
- Return type:
- Raises:
KeyError – If the datasplit name does not exist in the store.
Examples
>>> datasplit_config = store.retrieve_datasplit_config("datasplit1")
- store_array_config(array_config, ignore=None)
Stores the array configuration in the file config store.
- Parameters:
array_config (ArrayConfig) – The array configuration to store.
ignore (list, optional) – A list of keys to ignore when comparing the stored configuration with the new configuration. Defaults to None.
- Raises:
DuplicateNameError – If a configuration with the same name already exists.
Examples
>>> store.store_array_config(array_config)
- retrieve_array_config(array_name)
Retrieve the array configuration for a given array name.
- Parameters:
array_name (str) – The name of the array configuration to retrieve.
- Returns:
The array configuration object.
- Return type:
- Raises:
KeyError – If the array name does not exist in the store.
Examples
>>> array_config = store.retrieve_array_config("array1")
- retrieve_array_config_names()
Retrieve the names of the array configurations.
- Returns:
A list of array configuration names.
- Raises:
KeyError – If no array configurations are stored.
Examples
>>> array_names = store.retrieve_array_config_names()
- property users: upath.UPath
Returns the path to the users directory.
- Returns:
The path to the users directory.
- Return type:
Path
- Raises:
FileNotFoundError – If the users directory does not exist.
Examples
>>> store.users Path("path/to/configs/users")
- property runs: upath.UPath
Returns the path to the runs directory.
- Returns:
The path to the runs directory.
- Return type:
Path
- Raises:
FileNotFoundError – If the runs directory does not exist.
Examples
>>> store.runs Path("path/to/configs/runs")
- property tasks: upath.UPath
Returns the path to the tasks directory.
- Returns:
The path to the tasks directory.
- Return type:
Path
- Raises:
FileNotFoundError – If the tasks directory does not exist.
Examples
>>> store.tasks Path("path/to/configs/tasks")
- property datasplits: upath.UPath
Returns the path to the datasplits directory.
- Returns:
The path to the datasplits directory.
- Return type:
Path
- Raises:
FileNotFoundError – If the datasplits directory does not exist.
Examples
>>> store.datasplits Path("path/to/configs/datasplits")
- property arrays: upath.UPath
Returns the path to the arrays directory.
- Returns:
The path to the arrays directory.
- Return type:
Path
- Raises:
FileNotFoundError – If the arrays directory does not exist.
Examples
>>> store.arrays Path("path/to/configs/arrays")
- property architectures: upath.UPath
Returns the path to the architectures directory.
- Returns:
The path to the architectures directory.
- Return type:
Path
- Raises:
FileNotFoundError – If the architectures directory does not exist.
Examples
>>> store.architectures Path("path/to/configs/architectures")
- property trainers: upath.UPath
Returns the path to the trainers directory.
- Returns:
The path to the trainers directory.
- Return type:
Path
- Raises:
FileNotFoundError – If the trainers directory does not exist.
Examples
>>> store.trainers Path("path/to/configs/trainers")
- property datasets: upath.UPath
Returns the path to the datasets directory.
- Returns:
The path to the datasets directory.
- Return type:
Path
- Raises:
FileNotFoundError – If the datasets directory does not exist.
Examples
>>> store.datasets Path("path/to/configs/datasets")
- delete_config(database: upath.UPath, config_name: str) None
Deletes a configuration file from the specified database.
- Parameters:
database (Path) – The path to the database where the configuration file is stored.
config_name (str) – The name of the configuration file to be deleted.
- Raises:
FileNotFoundError – If the configuration file does not exist.
Examples
>>> store.delete_config(Path("path/to/configs"), "run1")