Skip to content

Commit eb777ff

Browse files
committed
[scheduler] Fix missing job progress on job completion
This change adds a check for job progress before generating the resuming arguments. If progress is not available, it defaults to the initial arguments, as the resuming arguments can't be obtained from the job result. Signed-off-by: Jose Javier Merchante <[email protected]>
1 parent 5fcdd42 commit eb777ff

File tree

1 file changed

+5
-2
lines changed
  • src/grimoirelab/core/scheduler/tasks

1 file changed

+5
-2
lines changed

src/grimoirelab/core/scheduler/tasks/models.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,11 @@ def prepare_job_parameters(self):
131131
job_args = args_gen.initial_args(self.task_args)
132132
elif self.status == SchedulerStatus.COMPLETED:
133133
job = self.jobs.all().order_by('-job_num').first()
134-
progress = ChroniclerProgress.from_dict(job.progress)
135-
job_args = args_gen.resuming_args(job.job_args['job_args'], progress)
134+
if job and job.progress:
135+
progress = ChroniclerProgress.from_dict(job.progress)
136+
job_args = args_gen.resuming_args(job.job_args['job_args'], progress)
137+
else:
138+
job_args = args_gen.initial_args(self.task_args)
136139
elif self.status == SchedulerStatus.RECOVERY:
137140
job = self.jobs.all().order_by('-job_num').first()
138141
if job and job.progress:

0 commit comments

Comments
 (0)