Add CLEARNL_CONFIG_VERBOSE to allow external control over verbosity of the configuration loading process

This commit is contained in:
allegroai 2021-08-07 19:33:40 +03:00
parent e93d65b871
commit 7bb78c01bf
3 changed files with 6 additions and 9 deletions

View File

@ -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

View File

@ -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()

View File

@ -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 """