Skip to content

Commit 8650971

Browse files
committed
fix:lookup error for task-type #228
1 parent e15fd38 commit 8650971

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scheduler/models/task.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ def success_callback(job, connection, result, *args, **kwargs):
5454

5555
task = Task.objects.filter(job_id=job.id).first()
5656
if task is None:
57-
model = apps.get_model(app_label="scheduler", model_name=task_type)
58-
task = model.objects.filter(job_id=job.id).first()
57+
try:
58+
model = apps.get_model(app_label="scheduler", model_name=task_type)
59+
task = model.objects.filter(job_id=job.id).first()
60+
except LookupError:
61+
pass
5962
if task is None:
60-
logger.warn(f"Could not find task for job {job.id}")
63+
logger.warn(f"Could not find task for job {task_type}/{job.id}")
6164
return
6265
task.job_id = None
6366
task.successful_runs += 1

0 commit comments

Comments
 (0)