From 51a68a0b111910e1587a89783477eb5490ab056d Mon Sep 17 00:00:00 2001 From: Nathan Freeman Date: Thu, 11 Jul 2024 16:50:00 -0500 Subject: [PATCH] Remove execution profile from entity dict --- src/api/src/backend/views/AddPipelineArchive.py | 4 ---- src/api/src/backend/views/Tasks.py | 9 ++++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/api/src/backend/views/AddPipelineArchive.py b/src/api/src/backend/views/AddPipelineArchive.py index a1b50900..8cec4b34 100644 --- a/src/api/src/backend/views/AddPipelineArchive.py +++ b/src/api/src/backend/views/AddPipelineArchive.py @@ -46,10 +46,6 @@ def post(self, request, group_id, pipeline_id): if archive == None: return NotFound(message=f"Archive '{body.archive_id}' does not exist for group '{group_id}'") - # Repsond with archive not found - if archive == None: - return NotFound(message=f"Archive '{body.archive_id}' not found in group '{group_id}'") - try: # Create the pipeline_archive PipelineArchive.objects.create( diff --git a/src/api/src/backend/views/Tasks.py b/src/api/src/backend/views/Tasks.py index 78d79485..221eeb01 100644 --- a/src/api/src/backend/views/Tasks.py +++ b/src/api/src/backend/views/Tasks.py @@ -140,10 +140,17 @@ def patch(self, request, group_id, pipeline_id, task_id): if (task_model.type != task.type): return BadRequest(f"Updating the type of a task is not allowed. Expected task.type: {task_model.type} - Recieved: {task.type}") + entity_dict = json.loads(task.json()) + entity_dict = { + **entity_dict, + **entity_dict.execution_profile + } + del entity_dict["execution_profile"] + Task.objects.filter( pipeline=pipeline, id=task_id - ).update(**json.loads(task.json())) + ).update(**entity_dict) return ModelResponse(Task.objects.filter(id=task.id, pipeline=pipeline).first()) except (DatabaseError, OperationalError, IntegrityError) as e: