X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=src%2Fpyutils%2Fconfig.py;h=ed9a8212c0c8d1c40a6ecabd933eb23f1bf5cbb1;hb=06aed70c0ceefccc830d8f77e0f39a97ed05b898;hp=ad97038ed4f4da3f603b84eaedd1d6cde8a77c55;hpb=a2cb839d6932060ea00ad9b9d7c198ab310affe4;p=pyutils.git diff --git a/src/pyutils/config.py b/src/pyutils/config.py index ad97038..ed9a821 100644 --- a/src/pyutils/config.py +++ b/src/pyutils/config.py @@ -224,6 +224,7 @@ GROUP.add_argument( GROUP.add_argument( '--config_allow_dynamic_updates', default=False, + action='store_true', help='If enabled, allow config flags with the string "dynamic" in their names to change at runtime when a new Zookeeper based configuration is created. See the --config_savefile help message for more information about this option.', ) GROUP.add_argument( @@ -702,6 +703,15 @@ def parse(entry_module: Optional[str]) -> Dict[str, Any]: return CONFIG.parse(entry_module) +def error(message: str, exit_code: int = 1) -> None: + """ + Convenience method for indicating a configuration error. + """ + logging.error(message) + print(message, file=sys.stderr) + sys.exit(exit_code) + + def has_been_parsed() -> bool: """Returns True iff the global config has already been parsed""" return CONFIG.has_been_parsed()