Skip to content

Commit

Permalink
add git pull to etl pipeline endpoint. debug
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Oct 13, 2023
1 parent 3898d6a commit 532058d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/api/src/backend/views/ETLPipelines.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import os, json

from pprint import pprint
import git

from typing import List
from pydantic import ValidationError
from django.db import DatabaseError, IntegrityError, OperationalError
from django.forms import model_to_dict
from git import Repo

from backend.views.RestrictedAPIView import RestrictedAPIView
from backend.views.http.responses.errors import (
Expand Down Expand Up @@ -83,14 +80,18 @@ def post(self, request, group_id, *_, **__):

# Clone the git repository that contains the pipeline and task definitions that will be used
tapis_owe_templates_dir = "/tmp/git/tapis-owe-templates"
if not os.path.exists(tapis_owe_templates_dir):
cloned = os.path.exists(tapis_owe_templates_dir)
if not cloned:
try:
Repo.clone_from(
git.Repo.clone_from(
uses.source.url,
tapis_owe_templates_dir
)
except Exception as e:
return ServerErrorResp(f"Error cloning the Tapis OWE Template repository: {str(e)}")

# A local tapis owe templates repo exists, update it with a git pull
git.cmd.Git(tapis_owe_templates_dir).pull()

try:
# Open the owe-config.json file
Expand Down
4 changes: 4 additions & 0 deletions src/api/src/backend/views/RunPipeline.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pprint import pprint

from django.db import DatabaseError, IntegrityError, OperationalError

from backend.views.RestrictedAPIView import RestrictedAPIView
Expand Down Expand Up @@ -65,6 +67,8 @@ def post(self, request, group_id, pipeline_id, *_, **__):
directives=body.directives,
args=body.args
)

pprint(pipeline_dispatch_request)

# Dispatch the request
pipeline_run = pipeline_dispatcher.dispatch(pipeline_dispatch_request, pipeline)
Expand Down

0 comments on commit 532058d

Please sign in to comment.