Skip to content
Snippets Groups Projects
Commit 2d5f2eb5 authored by Theo Lesage's avatar Theo Lesage Committed by Theo Lesage
Browse files

Add Task.original_task

parent ecf2c46b
No related branches found
No related tags found
No related merge requests found
......@@ -251,6 +251,7 @@ class TaskRestart(ProcessACLMixin, CreateAPIView):
copy.save()
# Copy the original task
copy.original_task_id = copy.id
copy.id = uuid.uuid4()
copy.slug = basename
copy.state = State.Pending
......
# Generated by Django 4.1.7 on 2024-04-23 12:19
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("ponos", "0007_remove_task_has_docker_socket"),
]
operations = [
migrations.AddField(
model_name="task",
name="original_task",
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="restarts", to="ponos.task"),
),
]
......@@ -313,13 +313,20 @@ class Task(models.Model):
related_name="children",
symmetrical=False,
)
container = models.CharField(
max_length=64,
null=True,
blank=True,
)
original_task = models.ForeignKey(
"self",
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="restarts"
)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
expiry = models.DateTimeField(default=expiry_default)
......
......@@ -89,6 +89,7 @@ class TaskSerializer(TaskLightSerializer):
"agent",
"gpu",
"extra_files",
"original_task_id"
)
read_only_fields = TaskLightSerializer.Meta.read_only_fields + (
"logs",
......@@ -96,6 +97,7 @@ class TaskSerializer(TaskLightSerializer):
"agent",
"gpu",
"extra_files",
"original_task_id"
)
@extend_schema_field(serializers.CharField())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment