Skip to content

Commit d8c4e00

Browse files
committed
[scheduler] Fix job argument generation
This change adds a check for job progress before generating recovery arguments. If progress is not available, it falls back to initial arguments. It also generates initial arguments from the task when the task status is neither RECOVERY nor COMPLETED. Signed-off-by: Jose Javier Merchante <[email protected]>
1 parent 5077ea4 commit d8c4e00

File tree

1 file changed

+6
-3
lines changed
  • src/grimoirelab/core/scheduler/tasks

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,13 @@ def prepare_job_parameters(self):
135135
job_args = args_gen.resuming_args(job.job_args['job_args'], progress)
136136
elif self.status == SchedulerStatus.RECOVERY:
137137
job = self.jobs.all().order_by('-job_num').first()
138-
progress = ChroniclerProgress.from_dict(job.progress)
139-
job_args = args_gen.recovery_args(job.job_args['job_args'], progress)
138+
if job and job.progress:
139+
progress = ChroniclerProgress.from_dict(job.progress)
140+
job_args = args_gen.recovery_args(job.job_args['job_args'], progress)
141+
else:
142+
job_args = args_gen.initial_args(self.task_args)
140143
else:
141-
job_args = self.task_args
144+
job_args = args_gen.initial_args(self.task_args)
142145

143146
task_args['job_args'] = job_args
144147

0 commit comments

Comments
 (0)