Exemple #1
0
 def test_on_success_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.time_start = 1
     tw.on_success(42)
     tw._does_info = False
     tw.on_success(42)
     self.assertFalse(tw.acknowledged)
Exemple #2
0
 def test_on_success_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.time_start = 1
     tw.on_success(42)
     tw._does_info = False
     tw.on_success(42)
     self.assertFalse(tw.acknowledged)
Exemple #3
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)
         tw._does_info = False
         tw.on_failure(einfo)
         einfo.internal = True
         tw.on_failure(einfo)
Exemple #4
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(sys.exc_info())
         tw.on_failure(einfo)
         self.assertIn("task-retried", tw.eventer.sent)
         tw._does_info = False
         tw.on_failure(einfo)
         einfo.internal = True
         tw.on_failure(einfo)