From 1d0b3547eaecebf883b2e5463deda0baee6e551c Mon Sep 17 00:00:00 2001 From: Nathan Freeman Date: Wed, 29 Nov 2023 13:24:51 -0600 Subject: [PATCH] debug. use model dump for conditions --- src/api/src/backend/services/TaskService.py | 7 ++++--- src/api/src/backend/views/ETLPipelines.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/src/backend/services/TaskService.py b/src/api/src/backend/services/TaskService.py index 7b4679af..b312a2b5 100644 --- a/src/api/src/backend/services/TaskService.py +++ b/src/api/src/backend/services/TaskService.py @@ -101,7 +101,7 @@ def create(self, pipeline, request): code=getattr(request, "code", None), command=getattr(request, "command", None), context=context, - conditions=getattr(request, "conditions", []), + conditions=getattr(request, "conditions", []).model_dump(), data=getattr(request, "data", None), description=request.description, destination=destination, @@ -151,8 +151,9 @@ def create(self, pipeline, request): except ModelValidationError as e: self.rollback() raise e - except Exception as e: - print(f"Generic Exception: {e}", request.id, flush=True) + except ServerError as e: + self.rollback() + # print(f"Generic Exception: {e}", request.id, flush=True) raise e return task diff --git a/src/api/src/backend/views/ETLPipelines.py b/src/api/src/backend/views/ETLPipelines.py index f5886505..15ec6a62 100644 --- a/src/api/src/backend/views/ETLPipelines.py +++ b/src/api/src/backend/views/ETLPipelines.py @@ -261,6 +261,8 @@ def post(self, request, group_id, *_, **__): task_service.delete(tasks) return BadRequest(message=e.__cause__) except ServerError as e: + pipeline.delete() + task_service.delete(tasks) return ServerErrorResp(message=e) except Exception as e: task_service.delete(tasks)