Beispiel #1
0
 def test_on_accepted_acks_late(self):
     job = TaskRequest(
         self.mytask.name, uuid(), [1], {'f': 'x'}, app=self.app,
     )
     self.mytask.acks_late = True
     job.on_accepted(pid=os.getpid(), time_accepted=time.time())
     self.assertFalse(job.acknowledged)
Beispiel #2
0
 def test_on_accepted_terminates(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     pool = Mock()
     tw.terminate(pool, signal="KILL")
     self.assertFalse(pool.terminate_job.call_count)
     tw.on_accepted(pid=314, time_accepted=time.time())
     pool.terminate_job.assert_called_with(314, "KILL")
Beispiel #3
0
 def test_on_accepted_terminates(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     pool = Mock()
     tw.terminate(pool, signal="KILL")
     self.assertFalse(pool.terminate_job.call_count)
     tw.on_accepted(pid=314, time_accepted=time.time())
     pool.terminate_job.assert_called_with(314, "KILL")
Beispiel #4
0
 def test_on_accepted_acks_late(self):
     tw = TaskRequest(mytask.name, gen_unique_id(), [1], {"f": "x"})
     mytask.acks_late = True
     try:
         tw.on_accepted()
         self.assertFalse(tw.acknowledged)
     finally:
         mytask.acks_late = False
Beispiel #5
0
 def test_on_accepted_acks_late(self):
     tw = TaskRequest(mytask.name, gen_unique_id(), [1], {"f": "x"})
     mytask.acks_late = True
     try:
         tw.on_accepted()
         self.assertFalse(tw.acknowledged)
     finally:
         mytask.acks_late = False
Beispiel #6
0
 def test_on_accepted_acks_late(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     mytask.acks_late = True
     try:
         tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
         self.assertFalse(tw.acknowledged)
     finally:
         mytask.acks_late = False
Beispiel #7
0
 def test_on_accepted_acks_late(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     mytask.acks_late = True
     try:
         tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
         self.assertFalse(tw.acknowledged)
     finally:
         mytask.acks_late = False
Beispiel #8
0
 def test_on_accepted_terminates(self):
     signum = signal.SIGKILL
     pool = Mock()
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     with assert_signal_called(task_revoked, sender=tw.task, terminated=True, expired=False, signum=signum):
         tw.terminate(pool, signal="KILL")
         self.assertFalse(pool.terminate_job.call_count)
         tw.on_accepted(pid=314, time_accepted=time.time())
         pool.terminate_job.assert_called_with(314, signum)
Beispiel #9
0
 def test_on_accepted_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'})
     tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
     self.assertTrue(tw.acknowledged)
     prev, module._does_debug = module._does_debug, False
     try:
         tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
     finally:
         module._does_debug = prev
Beispiel #10
0
 def test_on_accepted_acks_early(self):
     job = TaskRequest(self.mytask.name, uuid(), [1], {"f": "x"}, app=self.app)
     job.on_accepted(pid=os.getpid(), time_accepted=time.time())
     self.assertTrue(job.acknowledged)
     prev, module._does_debug = module._does_debug, False
     try:
         job.on_accepted(pid=os.getpid(), time_accepted=time.time())
     finally:
         module._does_debug = prev
Beispiel #11
0
 def test_on_accepted_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'}, app=self.app)
     tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
     self.assertTrue(tw.acknowledged)
     prev, module._does_debug = module._does_debug, False
     try:
         tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
     finally:
         module._does_debug = prev
Beispiel #12
0
 def test_on_accepted_terminates(self):
     signum = signal.SIGKILL
     pool = Mock()
     tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'})
     with assert_signal_called(task_revoked, sender=tw.task,
                               terminated=True,
                               expired=False,
                               signum=signum):
         tw.terminate(pool, signal='KILL')
         self.assertFalse(pool.terminate_job.call_count)
         tw.on_accepted(pid=314, time_accepted=time.time())
         pool.terminate_job.assert_called_with(314, signum)
Beispiel #13
0
 def test_on_accepted_terminates(self):
     signum = signal.SIGKILL
     pool = Mock()
     job = TaskRequest(
         self.mytask.name, uuid(), [1], {'f': 'x'}, app=self.app,
     )
     with assert_signal_called(
             task_revoked, sender=job.task,
             terminated=True, expired=False, signum=signum):
         job.terminate(pool, signal='KILL')
         self.assertFalse(pool.terminate_job.call_count)
         job.on_accepted(pid=314, time_accepted=time.time())
         pool.terminate_job.assert_called_with(314, signum)
Beispiel #14
0
 def test_on_accepted_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
     self.assertTrue(tw.acknowledged)
Beispiel #15
0
 def test_on_accepted_acks_early(self):
     tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"})
     tw.on_accepted(pid=os.getpid(), time_accepted=time.time())
     self.assertTrue(tw.acknowledged)
Beispiel #16
0
 def test_on_accepted_acks_early(self):
     tw = TaskRequest(mytask.name, gen_unique_id(), [1], {"f": "x"})
     tw.on_accepted()
     self.assertTrue(tw.acknowledged)
Beispiel #17
0
 def test_on_accepted_acks_early(self):
     tw = TaskRequest(mytask.name, gen_unique_id(), [1], {"f": "x"})
     tw.on_accepted()
     self.assertTrue(tw.acknowledged)