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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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)
Example #5
0
 def test_on_retry(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'}, app=self.app)
     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)
Example #6
0
 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)
Example #7
0
 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)
Example #8
0
 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)
 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)