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:
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:
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,
)