Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up config when database is disabled #578

Merged
merged 5 commits into from Dec 13, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions pyiron_base/state/settings.py
Expand Up @@ -334,6 +334,18 @@ def _update_from_dict(self, config: Dict, map_: Union[None, Dict] = None) -> Non
self._configuration[key] = self.convert_path_to_abs_posix(value)
elif key in ["project_check_enabled", "disable_database"]:
self._configuration[key] = value if isinstance(value, bool) else strtobool(value)
if self._configuration["disable_database"]:
if self._configuration["project_check_enabled"]:
raise ValueError(
"When the database is disabled 'disable_database=True' the project " +
"check cannot be enabled, so you have to set 'project_check_enabled=False'."
)
if len(self._configuration["project_paths"]) > 0:
raise ValueError(
"When the database is disabled 'disable_database=True' the project " +
"paths list should be empty 'project_paths=[]'. Currently it is: " +
str(self._configuration["project_paths"])
)
elif key not in self._configuration.keys():
raise KeyError(
f"Got unexpected configuration key {key}, please choose from among {self._configuration.keys()}"
Expand Down