Skip to content

Commit

Permalink
Convert pipeline run model to dict in dispatch request builder
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Nov 7, 2024
1 parent 5414923 commit 1b71bf8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/api/src/backend/helpers/PipelineDispatchRequestBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/api/src/backend/services/PipelineDispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/api/src/backend/views/PipelineRuns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1b71bf8

Please sign in to comment.