def handle(self, task): manager = Manager(task.stage, task.context) entity = model.get_proxy(task.payload) log.debug("Ingest: %r", entity) manager.ingest_entity(entity) manager.close() self.dispatch_next(task, manager.emitted)
def _ingest(self, dataset, task): manager = Manager(dataset, task.stage, task.context) entity = model.get_proxy(task.payload) log.debug("Ingest: %r", entity) try: manager.ingest_entity(entity) finally: manager.close() return manager.emitted
def handle_task(cls, queue, payload, context): queue.task_done() try: manager = Manager(queue, context) entity = model.get_proxy(payload) log.debug("Ingest: %r", entity) manager.ingest_entity(entity) manager.close() cls.handle_done(queue) except (KeyboardInterrupt, SystemExit, RuntimeError): cls.handle_retry(queue, payload, context) cls.handle_done(queue) raise except Exception: cls.handle_retry(queue, payload, context) cls.handle_done(queue) log.exception("Processing failed.")