def main(): """ High-level CLI operations. """ parser = setup_argparse() if len(sys.argv) == 1: parser.print_help(sys.stdout) return 1 args = parser.parse_args() setup_logging(logger=LOG, log_level=args.level.upper(), colors=True) try: args.func(args) except Exception as e: LOG.debug(traceback.format_exc()) LOG.error(str(e)) return 1
def main(): """ High-level CLI operations. """ parser = setup_argparse() if len(sys.argv) == 1: parser.print_help(sys.stdout) return 1 args = parser.parse_args() setup_logging(logger=LOG, log_level=args.level.upper(), colors=True) try: args.func(args) # pylint complains that this exception is too broad - being at the literal top of the program stack, # it's ok. except Exception as excpt: # pylint: disable=broad-except LOG.debug(traceback.format_exc()) LOG.error(str(excpt)) return 1 # All paths in a function ought to return an exit code, or none of them should. Given the # distributed nature of Merlin, maybe it doesn't make sense for it to exit 0 until the work is completed, but # if the work is dispatched with no errors, that is a 'successful' Merlin run - any other failures are runtime. return 0
def main(): parser = setup_argparse() args = parser.parse_args() setup_logging(logger=LOG, log_level=DEFAULT_LOG_LEVEL, colors=True) args.func(args)