Skip to content
Snippets Groups Projects

Link tasks to their restarts

Merged Theo Lesage requested to merge fk-task-restart into master
All threads resolved!
+ 4
0
@@ -236,6 +236,10 @@ class TaskRestart(ProcessACLMixin, CreateAPIView):
# Rename the original task
basename, *_ = copy.slug.rsplit("_old", 1)
if copy.original_task_id:
basename, *_ = copy.slug.rsplit("_old", 1)
else:
basename = copy.slug
latest_task = Task.objects.filter(run=copy.run, slug__startswith=f"{basename}_old").order_by("-created").first()
if not latest_task:
# There is no previously restarted task: the original task will have the slug slug_old1
Loading