def main():
parser = argparse.ArgumentParser()
parser.add_argument('command', choices=['run', 'list_events', 'print_configuration'])
parser.add_argument('components', nargs='?', default=None, type=str)
parser.add_argument('--verbose', '-v', action='store_true')
parser.add_argument('--config', '-c', type=str, default=None,
help='Path to a config file to load which will take precedence over all other configs')
parser.add_argument('--input_draw', '-d', type=int, default=0, help='Which GBD draw to use')
parser.add_argument('--model_draw', type=int, default=0, help="Which draw from the model's own variation to use")
parser.add_argument('--results_path', '-o', type=str, default=None, help='Path to write results to')
parser.add_argument('--process_number', '-n', type=int, default=1, help='Instance number for this process')
parser.add_argument('--log', type=str, default=None, help='Path to log file')
parser.add_argument('--pdb', action='store_true', help='Run in the debugger')
args = parser.parse_args()
log_level = logging.DEBUG if args.verbose else logging.ERROR
logging.basicConfig(filename=args.log, level=log_level)
try:
do_command(args)
except (BdbQuit, KeyboardInterrupt):
raise
except Exception as e:
if args.pdb:
import pdb
import traceback
traceback.print_exc()
pdb.post_mortem()
else:
logging.exception("Uncaught exception {}".format(e))
raise
评论列表
文章目录