From b8de7c6e5ee7d97e5d5a3a458e954f68a9ef7e78 Mon Sep 17 00:00:00 2001 From: sushanth Date: Tue, 19 Oct 2021 12:04:15 +0530 Subject: [PATCH] Updated sequence during history collection (#755) Co-authored-by: Najmudheen <45681499+NajmudheenCT@users.noreply.github.com> --- .../schedulers/telemetry/job_handler.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/delfin/task_manager/scheduler/schedulers/telemetry/job_handler.py b/delfin/task_manager/scheduler/schedulers/telemetry/job_handler.py index e94ac3f29..d8bc7d9b1 100644 --- a/delfin/task_manager/scheduler/schedulers/telemetry/job_handler.py +++ b/delfin/task_manager/scheduler/schedulers/telemetry/job_handler.py @@ -78,6 +78,19 @@ def schedule_job(self, task_id): if not (existing_job_id and scheduler_job): LOG.info('JobHandler scheduling a new job') + self.scheduler.add_job( + instance, 'interval', seconds=job['interval'], + next_run_time=next_collection_time, id=job_id, + misfire_grace_time=int( + CONF.telemetry.performance_collection_interval / 2)) + + update_task_dict = {'job_id': job_id + } + db.task_update(self.ctx, self.task_id, update_task_dict) + self.job_ids.add(job_id) + LOG.info('Periodic collection tasks scheduled for for job id: ' + '%s ' % self.task_id) + if job['last_run_time']: # Trigger one historic collection to make sure we do not # miss any Data points due to reschedule @@ -99,19 +112,6 @@ def schedule_job(self, task_id): db.task_update(self.ctx, self.task_id, {'last_run_time': last_run_time}) - - self.scheduler.add_job( - instance, 'interval', seconds=job['interval'], - next_run_time=next_collection_time, id=job_id, - misfire_grace_time=int( - CONF.telemetry.performance_collection_interval / 2)) - - update_task_dict = {'job_id': job_id - } - db.task_update(self.ctx, self.task_id, update_task_dict) - self.job_ids.add(job_id) - LOG.info('Periodic collection tasks scheduled for for job id: ' - '%s ' % self.task_id) else: LOG.info('Job already exists with this scheduler')