Skip to content

Commit

Permalink
use dict notation to access tasks from pipeline template
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Oct 11, 2023
1 parent a3b65f5 commit 189aefa
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/api/src/backend/views/ETLPipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,25 +220,20 @@ def post(self, request, group_id, *_, **__):

# Create a tapis job task for each job provided in the request.
tasks = []
print("BODY")
pprint(body)
for i, job in enumerate(body.jobs, start=1):
task_id = f"etl-job-{i}"
tasks.append(
TapisJobTask(**{
"id": task_id,
"type": "tapis_job",
"tapis_job_def": job,
"dependencies": [{"id": last_task_id}]
"depends_on": [{"id": last_task_id}]
})
)
last_task_id = task_id

print("TASKS")
pprint(tasks)

# Add the tasks from the template to the tasks list
tasks.extend([TemplateTask(**task) for task in pipeline_template.tasks])
tasks.extend([TemplateTask(**task) for task in pipeline_template.get("tasks")])

print("AFTER TASK REQUEST CREATE")
# Update the dependecies of the gen-outbound-manifests task to
Expand All @@ -252,6 +247,7 @@ def post(self, request, group_id, *_, **__):
for task in tasks:
try:
task_service.create(pipeline, task)
print("TASK CREATED", task)
except (ValidationError, BadRequestError) as e:
pipeline.delete()
task_service.delete(tasks)
Expand Down

0 comments on commit 189aefa

Please sign in to comment.