summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2022-08-18 08:54:59 -0700
committerScott Gasch <[email protected]>2022-08-18 08:54:59 -0700
commit91df4fa006f7f4fba8e38a97941c5a4ad9b83706 (patch)
tree9cbae663eac71d6127ce2d4c6b8c268eaa5a2800
parenta993e44371ada4ae0c592058bd98f1c61342c04f (diff)
Add an option to exit immediately upon setting zookeeper. Change the
verbosity of a warning.
-rw-r--r--config.py11
-rw-r--r--logging_utils.py2
2 files changed, 12 insertions, 1 deletions
diff --git a/config.py b/config.py
index c883a3b..1a362a3 100644
--- a/config.py
+++ b/config.py
@@ -188,6 +188,12 @@ GROUP.add_argument(
action='store_true',
help='If present, config will raise an exception if it doesn\'t recognize an argument. The default behavior is to ignore unknown arguments so as to allow interoperability with programs that want to use their own argparse calls to parse their own, separate commandline args.',
)
+GROUP.add_argument(
+ '--config_exit_after_parse',
+ default=False,
+ action='store_true',
+ help='If present, halt the program after parsing config. Useful, for example, to write a --config_savefile and then terminate.',
+)
class Config:
@@ -574,6 +580,11 @@ class Config:
self.dump_config()
self.config_parse_called = True
+ if config['config_exit_after_parse']:
+ print("Exiting because of --config_exit_after_parse.")
+ if self.zk:
+ self.zk.stop()
+ sys.exit(0)
return self.config
def has_been_parsed(self) -> bool:
diff --git a/logging_utils.py b/logging_utils.py
index 39453b4..f7e3be6 100644
--- a/logging_utils.py
+++ b/logging_utils.py
@@ -427,7 +427,7 @@ def log_about_logging(
level_name = logging._levelToName.get(default_logging_level, str(default_logging_level))
logger.debug('Initialized global logging; default logging level is %s.', level_name)
if config.config['logging_clear_preexisting_handlers'] and preexisting_handlers_count > 0:
- logger.warning(
+ logger.debug(
'Logging cleared %d global handlers (--logging_clear_preexisting_handlers)',
preexisting_handlers_count,
)