def on_message(self, body, message): self._forward_clock() # just increase clock as clients usually don't # have a valid clock to adjust with. try: with maybe_block(): self.node.handle_message(body, message) except KeyError as exc: error('No such control command: %s', exc) except Exception as exc: error('Control command error: %r', exc, exc_info=True) self.reset()
def send(self, context, exc, fail_silently=True): if self.should_send(context, exc): with maybe_block(): self.task.app.mail_admins( self.format_subject(context), self.format_body(context), fail_silently=fail_silently )
def store_result(self, task_id, result, status, traceback=None, **kwargs): """Update task state and result.""" result = self.encode_result(result, status) with maybe_block(): self._store_result(task_id, result, status, traceback, **kwargs) return result