本文整理汇总了Python中billiard.einfo.ExceptionInfo.exception方法的典型用法代码示例。如果您正苦于以下问题:Python ExceptionInfo.exception方法的具体用法?Python ExceptionInfo.exception怎么用?Python ExceptionInfo.exception使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类billiard.einfo.ExceptionInfo
的用法示例。
在下文中一共展示了ExceptionInfo.exception方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_failure
# 需要导入模块: from billiard.einfo import ExceptionInfo [as 别名]
# 或者: from billiard.einfo.ExceptionInfo import exception [as 别名]
def handle_failure(self, task, req, store_errors=True, call_errbacks=True):
"""Handle exception."""
_, _, tb = sys.exc_info()
try:
exc = self.retval
# make sure we only send pickleable exceptions back to parent.
einfo = ExceptionInfo()
einfo.exception = get_pickleable_exception(einfo.exception)
einfo.type = get_pickleable_etype(einfo.type)
task.backend.mark_as_failure(
req.id, exc, einfo.traceback,
request=req, store_result=store_errors,
call_errbacks=call_errbacks,
)
task.on_failure(exc, req.id, req.args, req.kwargs, einfo)
signals.task_failure.send(sender=task, task_id=req.id,
exception=exc, args=req.args,
kwargs=req.kwargs,
traceback=tb,
einfo=einfo)
self._log_error(task, req, einfo)
return einfo
finally:
del(tb)
示例2: handle_failure
# 需要导入模块: from billiard.einfo import ExceptionInfo [as 别名]
# 或者: from billiard.einfo.ExceptionInfo import exception [as 别名]
def handle_failure(self, task, store_errors=True):
"""Handle exception."""
req = task.request
type_, _, tb = sys.exc_info()
try:
exc = self.retval
einfo = ExceptionInfo()
einfo.exception = get_pickleable_exception(einfo.exception)
einfo.type = get_pickleable_etype(einfo.type)
if store_errors:
task.backend.mark_as_failure(req.id, exc, einfo.traceback, request=req)
task.on_failure(exc, req.id, req.args, req.kwargs, einfo)
signals.task_failure.send(
sender=task, task_id=req.id, exception=exc, args=req.args, kwargs=req.kwargs, traceback=tb, einfo=einfo
)
return einfo
finally:
del (tb)