runner.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:catalearn 作者: Catalearn 项目源码 文件源码
def add_error_handling(run_job_func):

    def wrap(*args, **kwargs):
        try:
            return run_job_func(*args, **kwargs)

        # all keyboard interrupt during streaming will be caught and raised as JobInterruptedException
        # anything here will be during upload or download, so we just abort
        except KeyboardInterrupt as e:
            print('\nJob aborted')
            abort_and_print_credit()
            # print('\nStreaming stopped, code is still running in the cloud')
            # print('Your job hash is: %s' % settings.CURRENT_JOB_HASH)

        except RequestFailedException as e:
            print('Oops, something went wrong...')
            print(e.error_msg)
            print('Please try again later')
            sys.tracebacklimit = 0
            sys.exit()

        # except JobInterruptedException as e:
        #     # extra newline incase no newline was printed
        #     # print('\nJob interrupted')
        #     # ans = input('Do you want to abort the job?\n')
        #     # if ans == 'yes':
        #     #     abort_and_print_credit()
        #     # else:
        #     #     print('Job is still running\n')
        #     #     print('To reconnect to the job:\n')
        #     #     print('    catalearn.reconnect()\n')
        #     #     print('To stop the job:\n')
        #     #     print('    catalearn.stop()\n')
        #     print('Job aborted')
        #     abort_and_print_credit()

    return wrap
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号