def main():
    [args, run_opts] = get_args()
    try:
        train(args, run_opts)
        common_lib.wait_for_background_commands()
    except BaseException as e:
        if (args.email is not None):
            message = 'Training session for experiment {dir} died due to an error.'.format(dir=args.dir)
            common_lib.send_mail(message, message, args.email)
        if (not isinstance(e, KeyboardInterrupt)):
            traceback.print_exc()
        sys.exit(1)
def main():
    [args, run_opts] = get_args()
    try:
        train(args, run_opts)
        common_lib.wait_for_background_commands()
    except BaseException as e:
        if (args.email is not None):
            message = 'Training session for experiment {dir} died due to an error.'.format(dir=args.dir)
            common_lib.send_mail(message, message, args.email)
        if (not isinstance(e, KeyboardInterrupt)):
            traceback.print_exc()
        sys.exit(1)