Skip to content

Commit

Permalink
Fix pipeline sumission request builder logic
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Nov 6, 2024
1 parent a8f1d90 commit 3e4292d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def build(
request["pipeline_run"]["description"] = description

# if not directives are provided. Default to RUN
request["directives"] = directives if directives else {"RUN": run.uuid}
request["directives"] = directives if directives else {"RUN": request["pipeline_run"]["uuid"]}

return request

Expand Down
19 changes: 19 additions & 0 deletions src/api/src/backend/migrations/0032_alter_task_flavor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.1.2 on 2024-11-05 19:38

import backend.views.http.requests
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('backend', '0031_groupsecret_secret_group_description_and_more'),
]

operations = [
migrations.AlterField(
model_name='task',
name='flavor',
field=models.CharField(choices=[(backend.views.http.requests.EnumTaskFlavor['C1_TINY'], backend.views.http.requests.EnumTaskFlavor['C1_TINY']), (backend.views.http.requests.EnumTaskFlavor['C1_XXSML'], backend.views.http.requests.EnumTaskFlavor['C1_XXSML']), (backend.views.http.requests.EnumTaskFlavor['C1_XSML'], backend.views.http.requests.EnumTaskFlavor['C1_XSML']), (backend.views.http.requests.EnumTaskFlavor['C1_SML'], backend.views.http.requests.EnumTaskFlavor['C1_SML']), (backend.views.http.requests.EnumTaskFlavor['C1_MED'], backend.views.http.requests.EnumTaskFlavor['C1_MED']), (backend.views.http.requests.EnumTaskFlavor['C1_LRG'], backend.views.http.requests.EnumTaskFlavor['C1_LRG']), (backend.views.http.requests.EnumTaskFlavor['C1_XLRG'], backend.views.http.requests.EnumTaskFlavor['C1_XLRG']), (backend.views.http.requests.EnumTaskFlavor['C1_XXLRG'], backend.views.http.requests.EnumTaskFlavor['C1_XXLRG']), (backend.views.http.requests.EnumTaskFlavor['G1_NVD_SML'], backend.views.http.requests.EnumTaskFlavor['G1_NVD_SML']), (backend.views.http.requests.EnumTaskFlavor['G1_NVD_MED'], backend.views.http.requests.EnumTaskFlavor['G1_NVD_MED']), (backend.views.http.requests.EnumTaskFlavor['G1_NVD_LRG'], backend.views.http.requests.EnumTaskFlavor['G1_NVD_LRG'])], default=backend.views.http.requests.EnumTaskFlavor['C1_MED'], max_length=32),
),
]
2 changes: 1 addition & 1 deletion src/api/src/backend/services/PipelineDispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def dispatch(self, service_request: dict, pipeline, pipeline_run=None):
now = timezone.now()
try:
# Create the pipeline run object if one was not provied
if pipeline_run != None:
if pipeline_run == None:
pipeline_run = PipelineRun.objects.create(
name=service_request["pipeline_run"]["name"],
description=service_request["pipeline_run"]["description"],
Expand Down
3 changes: 3 additions & 0 deletions src/api/src/backend/views/RunPipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from backend.services.GroupService import service as group_service
from backend.services.CredentialsService import service as credentials_service
from backend.models import Pipeline
from backend.utils import logger


request_builder = PipelineDispatchRequestBuilder(credentials_service)
Expand Down Expand Up @@ -64,8 +65,10 @@ def post(self, request, group_id, pipeline_id, *_, **__):
# Dispatch the request
pipeline_run = pipeline_dispatcher.dispatch(pipeline_dispatch_request, pipeline)
except ServerError as e:
logger.exception(e.__cause__)
return ServerErrorResp(message=str(e))
except Exception as e:
logger.exception(e.__cause__)
return ServerErrorResp(message=str(e))

# Respond with the pipeline run
Expand Down
6 changes: 2 additions & 4 deletions src/engine/src/Server.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ def __call__(self):
# Create a worker pool that consists of the workflow executors that will
# run the pipelines
# TODO catch error for worker classes that dont inherit from "Worker"
logger.info(f"Initializing workers {PLUGINS}")
logger.info(f"Starting workers {STARTING_WORKERS}")
logger.info(f"Max workers {MAX_WORKERS}")
logger.info(f"Starting {STARTING_WORKERS} workers. Max workers ({MAX_WORKERS})")
self.worker_pool = WorkerPool(
worker_cls=WorkflowExecutor,
starting_worker_count=STARTING_WORKERS,
Expand Down Expand Up @@ -104,7 +102,7 @@ def __call__(self):
)
)

logger.debug(f"Worker Engine Server started and ready to recieve workflow submissions.")
logger.debug(f"Server started and ready to recieve workflow submissions.")

channel.start_consuming()

Expand Down

0 comments on commit 3e4292d

Please sign in to comment.