From 1b71bf822a639dc41e7865a38a44924fa39cf96c Mon Sep 17 00:00:00 2001 From: Nathan Freeman Date: Thu, 7 Nov 2024 13:47:19 -0600 Subject: [PATCH] Convert pipeline run model to dict in dispatch request builder --- .../src/backend/helpers/PipelineDispatchRequestBuilder.py | 8 ++++---- src/api/src/backend/services/PipelineDispatcher.py | 3 --- src/api/src/backend/views/PipelineRuns.py | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/api/src/backend/helpers/PipelineDispatchRequestBuilder.py b/src/api/src/backend/helpers/PipelineDispatchRequestBuilder.py index 15943bf5..d683c05a 100644 --- a/src/api/src/backend/helpers/PipelineDispatchRequestBuilder.py +++ b/src/api/src/backend/helpers/PipelineDispatchRequestBuilder.py @@ -18,7 +18,7 @@ def build( description=None, commit=None, directives=None, - run=None, + pipeline_run=None, args={} ): # Get the pipeline tasks, their contexts, destinations, and respective @@ -89,14 +89,14 @@ def build( request["meta"]["origin"] = base_url # Origin of the request - request["pipeline_run"] = run if run else {} - if not run: + request["pipeline_run"] = model_to_dict(pipeline_run) if pipeline_run else {} + if not pipeline_run: uuid = uuid4() request["pipeline_run"]["uuid"] = uuid request["pipeline_run"]["name"] = name or uuid request["pipeline_run"]["description"] = description - # if not directives are provided. Default to RUN + # If no directives are provided. Default to RUN request["directives"] = directives if directives else {"RUN": request["pipeline_run"]["uuid"]} return request diff --git a/src/api/src/backend/services/PipelineDispatcher.py b/src/api/src/backend/services/PipelineDispatcher.py index 3e87934e..72926937 100644 --- a/src/api/src/backend/services/PipelineDispatcher.py +++ b/src/api/src/backend/services/PipelineDispatcher.py @@ -8,7 +8,6 @@ from backend.services.MessageBroker import service as broker from backend.models import Pipeline, PipelineRun, RUN_STATUS_SUBMITTED from backend.errors.api import ServerError -from pprint import pprint class PipelineDispatcher: @@ -51,8 +50,6 @@ def dispatch(self, service_request: dict, pipeline, pipeline_run=None): logger.exception(e.__cause__) raise ServerError(message=str(e)) - - pprint(service_request) try: broker.publish( "workflows", diff --git a/src/api/src/backend/views/PipelineRuns.py b/src/api/src/backend/views/PipelineRuns.py index a5f61692..84269ccb 100644 --- a/src/api/src/backend/views/PipelineRuns.py +++ b/src/api/src/backend/views/PipelineRuns.py @@ -74,7 +74,7 @@ def post(self, request, group_id, pipeline_id, pipeline_run_uuid): pipeline, directives={"TEMINATE_RUN": [pipeline_run_uuid]}, args={}, - run=pipeline_run, + pipeline_run=pipeline_run, ) # Dispatch the request run = pipeline_dispatcher.dispatch(pipeline_dispatch_request, pipeline, pipeline_run=pipeline_run)