From 7bb78c01bf1791010978eb8b90f084772ea64d78 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Sat, 7 Aug 2021 19:33:40 +0300 Subject: [PATCH] Add CLEARNL_CONFIG_VERBOSE to allow external control over verbosity of the configuration loading process --- clearml/backend_api/config/__init__.py | 2 +- clearml/backend_config/config.py | 11 +++-------- clearml/backend_config/defs.py | 2 ++ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/clearml/backend_api/config/__init__.py b/clearml/backend_api/config/__init__.py index a094fc30..d3492039 100644 --- a/clearml/backend_api/config/__init__.py +++ b/clearml/backend_api/config/__init__.py @@ -10,7 +10,7 @@ def load(*additional_module_paths): configurations should be loaded as well :return: Config object """ - config = Config(verbose=False) + config = Config() this_module_path = Path(__file__).parent config.load_relative_to(this_module_path, *additional_module_paths) return config diff --git a/clearml/backend_config/config.py b/clearml/backend_config/config.py index 7562e624..1fd10c2e 100644 --- a/clearml/backend_config/config.py +++ b/clearml/backend_config/config.py @@ -29,6 +29,7 @@ from .defs import ( LOCAL_CONFIG_FILES, LOCAL_CONFIG_FILE_OVERRIDE_VAR, ENV_CONFIG_PATH_OVERRIDE_VAR, + CONFIG_VERBOSE, ) from .defs import is_config_file from .entry import Entry, NotSet @@ -64,12 +65,6 @@ class ConfigEntry(Entry): class Config(object): - """ - Represents a server configuration. - If watch=True, will watch configuration folders for changes and reload itself. - NOTE: will not watch folders that were created after initialization. - """ - # used in place of None in Config.get as default value because None is a valid value _MISSING = object() @@ -77,14 +72,14 @@ class Config(object): self, config_folder=None, env=None, - verbose=True, + verbose=None, relative_to=None, app=None, is_server=False, **_ ): self._app = app - self._verbose = verbose + self._verbose = verbose if verbose is not None else CONFIG_VERBOSE.get() self._folder_name = config_folder or DEFAULT_CONFIG_FOLDER self._roots = [] self._config = ConfigTree() diff --git a/clearml/backend_config/defs.py b/clearml/backend_config/defs.py index 6a6c6169..31f2d46b 100644 --- a/clearml/backend_config/defs.py +++ b/clearml/backend_config/defs.py @@ -42,6 +42,8 @@ ENV_CONFIG_PATH_OVERRIDE_VAR = EnvEntry("CLEARML_CONFIG_PATH", "TRAINS_CONFIG_PA Environment-related config path override environment variable. If this is set, no other env config path will be used. """ +CONFIG_VERBOSE = EnvEntry("CLEARML_CONFIG_VERBOSE", type=bool) + class Environment(object): """ Supported environment names """