def main():
# Trigger cleanup on SIGTERM and SIGHUP
signal(SIGTERM, exit_handler)
signal(SIGHUP, exit_handler)
cli_plugins = lago.plugins.load_plugins(
lago.plugins.PLUGIN_ENTRY_POINTS['cli']
)
out_plugins = lago.plugins.load_plugins(
lago.plugins.PLUGIN_ENTRY_POINTS['out']
)
parser = create_parser(
cli_plugins=cli_plugins,
out_plugins=out_plugins,
)
args = parser.parse_args()
config.update_args(args)
logging.basicConfig(level=logging.DEBUG)
logging.root.handlers = [
log_utils.TaskHandler(
task_tree_depth=args.logdepth,
level=getattr(logging, args.loglevel.upper()),
dump_level=logging.ERROR,
formatter=log_utils.ColorFormatter(fmt='%(msg)s', )
)
]
logging.captureWarnings(True)
if args.ignore_warnings:
logging.getLogger('py.warnings').setLevel(logging.ERROR)
else:
warnings.formatwarning = lambda message, *args, **kwargs: message
args.out_format = out_plugins[args.out_format]
if args.prefix_path:
warnings.warn(
'The option --prefix-path is going to be deprecated, use '
'--workdir and --prefix instead',
DeprecationWarning,
)
try:
cli_plugins[args.verb].do_run(args)
except utils.LagoException as e:
LOGGER.info(e.message)
LOGGER.debug(e)
sys.exit(2)
except Exception:
LOGGER.exception('Error occured, aborting')
sys.exit(1)
评论列表
文章目录