当前位置: 首页>>代码示例>>Python>>正文


Python einfo.ExceptionInfo类代码示例

本文整理汇总了Python中billiard.einfo.ExceptionInfo的典型用法代码示例。如果您正苦于以下问题:Python ExceptionInfo类的具体用法?Python ExceptionInfo怎么用?Python ExceptionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ExceptionInfo类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle_failure

    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)
开发者ID:yingzong,项目名称:celery,代码行数:26,代码来源:trace.py

示例2: test_on_retry

 def test_on_retry(self):
     job = self.get_request(self.mytask.s(1, f='x'))
     job.eventer = MockEventDispatcher()
     try:
         raise Retry('foo', KeyError('moofoobar'))
     except:
         einfo = ExceptionInfo()
         job.on_failure(einfo)
         self.assertIn('task-retried', job.eventer.sent)
         prev, module._does_info = module._does_info, False
         try:
             job.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         job.on_failure(einfo)
开发者ID:hanshoudong,项目名称:celery,代码行数:16,代码来源:test_request.py

示例3: test_on_retry

 def test_on_retry(self):
     job = Request({"task": self.mytask.name, "id": uuid(), "args": [1], "kwargs": {"f": "x"}}, app=self.app)
     job.eventer = MockEventDispatcher()
     try:
         raise Retry("foo", KeyError("moofoobar"))
     except:
         einfo = ExceptionInfo()
         job.on_failure(einfo)
         self.assertIn("task-retried", job.eventer.sent)
         prev, module._does_info = module._does_info, False
         try:
             job.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         job.on_failure(einfo)
开发者ID:rhayesbite,项目名称:celery,代码行数:16,代码来源:test_request.py

示例4: test_on_retry

 def test_on_retry(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'})
     tw.eventer = MockEventDispatcher()
     try:
         raise RetryTaskError('foo', KeyError('moofoobar'))
     except:
         einfo = ExceptionInfo()
         tw.on_failure(einfo)
         self.assertIn('task-retried', tw.eventer.sent)
         prev, module._does_info = module._does_info, False
         try:
             tw.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         tw.on_failure(einfo)
开发者ID:arunsuresh,项目名称:celery,代码行数:16,代码来源:test_request.py

示例5: handle_failure

 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)
开发者ID:kalefranz,项目名称:celery,代码行数:18,代码来源:trace.py

示例6: test_on_retry

 def test_on_retry(self):
     job = self.get_request(self.mytask.s(1, f='x'))
     job.eventer = Mock(name='.eventer')
     try:
         raise Retry('foo', KeyError('moofoobar'))
     except:
         einfo = ExceptionInfo()
         job.on_failure(einfo)
         job.eventer.send.assert_called_with(
             'task-retried',
             uuid=job.id,
             exception=safe_repr(einfo.exception.exc),
             traceback=safe_str(einfo.traceback),
         )
         prev, module._does_info = module._does_info, False
         try:
             job.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         job.on_failure(einfo)
开发者ID:alekibango,项目名称:celery,代码行数:21,代码来源:test_request.py

示例7: test_on_retry

 def test_on_retry(self):
     job = Request({
         'task': self.mytask.name,
         'id': uuid(),
         'args': [1],
         'kwargs': {'f': 'x'},
     }, app=self.app)
     job.eventer = MockEventDispatcher()
     try:
         raise Retry('foo', KeyError('moofoobar'))
     except:
         einfo = ExceptionInfo()
         job.on_failure(einfo)
         self.assertIn('task-retried', job.eventer.sent)
         prev, module._does_info = module._does_info, False
         try:
             job.on_failure(einfo)
         finally:
             module._does_info = prev
         einfo.internal = True
         job.on_failure(einfo)
开发者ID:Arizona-Tecnologia,项目名称:celery,代码行数:21,代码来源:test_request.py


注:本文中的billiard.einfo.ExceptionInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。