arthur/scheduler.py
def _handle_successful_job(self, job):
        """Handle successufl jobs"""

        result = job.result
        task_id = job.kwargs['task_id']

        try:
            task = self.registry.get(task_id)
        except NotFoundError:
            logger.warning("Task %s not found; related job #%s will not be rescheduled",
                           task_id, job.id)
            return

        if task.archiving_cfg and task.archiving_cfg.fetch_from_archive:
            logger.info("Job #%s (task: %s) successfully finished", job.id, task_id)
            return

        if result.nitems > 0:
            task.backend_args['next_from_date'] = unixtime_to_datetime(result.max_date)

            if result.offset:
                task.backend_args['next_offset'] = result.offset

        job_args = self._build_job_arguments(task)

        delay = task.scheduling_cfg.delay if task.scheduling_cfg else WAIT_FOR_QUEUING

        job_id = self._scheduler.schedule_job_task(Q_UPDATING_JOBS,
                                                   task_id, job_args,
                                                   delay=delay)

        logger.info("Job #%s (task: %s, old job: %s) re-scheduled",
                    job_id, task_id, job.id)
def _handle_successful_job(self, job):
        """Handle successufl jobs"""

        result = job.result
        task_id = job.kwargs['task_id']

        try:
            task = self.registry.get(task_id)
        except NotFoundError:
            logger.warning("Task %s not found; related job #%s will not be rescheduled",
                           task_id, job.id)
            return

        if task.archiving_cfg and task.archiving_cfg.fetch_from_archive:
            logger.info("Job #%s (task: %s) successfully finished", job.id, task_id)
            return

        if result.nitems > 0:
            task.backend_args['next_from_date'] = unixtime_to_datetime(result.max_date)

            if result.offset:
                task.backend_args['next_offset'] = result.offset

        job_args = self._build_job_arguments(task)

        delay = task.scheduling_cfg.delay if task.scheduling_cfg else WAIT_FOR_QUEUING

        job_id = self._scheduler.schedule_job_task(Q_UPDATING_JOBS,
                                                   task_id, job_args,
                                                   delay=delay)

        logger.info("Job #%s (task: %s, old job: %s) re-scheduled",
                    job_id, task_id, job.id)
Handle successufl jobs