From c02c5ec24d87b4dfba348057ee2cff62615d854c Mon Sep 17 00:00:00 2001 From: Nathan Freeman Date: Wed, 10 Jul 2024 14:36:50 -0500 Subject: [PATCH] Debug task patch --- .../src/backend/serializers/FunctionTaskSerializer.py | 6 ++++++ src/api/src/backend/serializers/TaskSerializer.py | 7 +++++++ src/api/src/backend/serializers/__init__.py | 4 +++- src/api/src/backend/views/Tasks.py | 9 +++++++-- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 src/api/src/backend/serializers/FunctionTaskSerializer.py create mode 100644 src/api/src/backend/serializers/TaskSerializer.py diff --git a/src/api/src/backend/serializers/FunctionTaskSerializer.py b/src/api/src/backend/serializers/FunctionTaskSerializer.py new file mode 100644 index 00000000..745e978b --- /dev/null +++ b/src/api/src/backend/serializers/FunctionTaskSerializer.py @@ -0,0 +1,6 @@ +from backend.serializers import FunctionTaskSerializer + +class FunctionTaskSerializer: + @staticmethod + def serialize(model): + return \ No newline at end of file diff --git a/src/api/src/backend/serializers/TaskSerializer.py b/src/api/src/backend/serializers/TaskSerializer.py new file mode 100644 index 00000000..4be99d4c --- /dev/null +++ b/src/api/src/backend/serializers/TaskSerializer.py @@ -0,0 +1,7 @@ +from backend.serializers import FunctionTaskSerializer + +class TaskSerializer: + @staticmethod + def serialize(model): + if model.type == "function": + return FunctionTaskSerializer.serialize(model) \ No newline at end of file diff --git a/src/api/src/backend/serializers/__init__.py b/src/api/src/backend/serializers/__init__.py index cf16b1ff..2109c20f 100644 --- a/src/api/src/backend/serializers/__init__.py +++ b/src/api/src/backend/serializers/__init__.py @@ -1,3 +1,5 @@ from backend.serializers.UUIDSerializer import UUIDSerializer from backend.serializers.PipelineLockModelSerializer import PipelineLockModelSerializer -from backend.serializers.PipelineLockAcquisitionResponseSerializer import PipelineLockAcquisitionResponseSerializer \ No newline at end of file +from backend.serializers.PipelineLockAcquisitionResponseSerializer import PipelineLockAcquisitionResponseSerializer +from backend.serializers.TaskSerializer import TaskSerializer +from backend.serializers.FunctionTaskSerializer import FunctionTaskSerializer \ No newline at end of file diff --git a/src/api/src/backend/views/Tasks.py b/src/api/src/backend/views/Tasks.py index 368e715a..c6daf6ce 100644 --- a/src/api/src/backend/views/Tasks.py +++ b/src/api/src/backend/views/Tasks.py @@ -1,4 +1,4 @@ -import json +import json, pprint from django.db import IntegrityError, OperationalError, DatabaseError from django.forms import model_to_dict @@ -131,8 +131,13 @@ def patch(self, request, group_id, pipeline_id, task_id): # Resolve the the proper pydantic object for this task type TaskSchema = task_service.resolve_request_type(task_model.type) + serialized_task = model_to_dict(task_model) + + print(serialized_task) + pprint(serialized_task) + task = TaskSchema(**{ - **model_to_dict(task_model), + **serialized_task, **self.request_body })