def test_on_failure_Terminated_acknowledges(self): einfo = None try: raise Terminated('9') except Terminated: einfo = ExceptionInfo() assert einfo is not None req = self.get_request(self.add.s(2, 2)) req.on_failure(einfo) req.on_ack.assert_called_with(req_logger, req.connection_errors)
def test_on_failure_Termianted(self): einfo = None try: raise Terminated('9') except Terminated: einfo = ExceptionInfo() self.assertIsNotNone(einfo) req = self.get_request(self.add.s(2, 2)) req.on_failure(einfo) req.eventer.send.assert_called_with( 'task-revoked', uuid=req.id, terminated=True, signum='9', expired=False, )
def test_on_failure_task_cancelled(self): job = self.xRequest() job.eventer = Mock() job.time_start = 1 job._already_cancelled = True try: raise Terminated() except Terminated: exc_info = ExceptionInfo() job.on_failure(exc_info) job.on_failure(exc_info) assert not job.eventer.send.called
def test_on_failure_task_cancelled(self): job = self.xRequest() job.eventer = Mock() job.time_start = 1 job.message.channel.connection = None try: raise Terminated() except Terminated: exc_info = ExceptionInfo() job.on_failure(exc_info) assert job._already_cancelled job.on_failure(exc_info) job.eventer.send.assert_called_once_with('task-cancelled', uuid=job.id)
def generate_input_cancel_handler(signum, frame): logging.info('TASK CANCELLATION') if proc is not None: os.killpg(os.getpgid(proc.pid), 15) raise Terminated("Cancellation request sent from API")