Skip to content

Commit

Permalink
debug git cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Oct 19, 2023
1 parent 39f2622 commit a4a2b23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/engine/src/helpers/GitCacheService.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ def add(self, url: str, directory: str):
git.Repo.clone_from(url, os.path.join(self._cache_dir, directory.lstrip("/")))

def repo_exists(self, path):
print("REPO EXISTS", os.path.exists(path))
return os.path.exists(path)

def update(self, directory):
print("GIT PULL", directory)
git.cmd.Git(directory).pull()

def add_or_update(self, url, directory):
print("ADD OR UPDATE", directory)
if not self.repo_exists(directory):
print("CREATING", url, directory)
self.add(url, directory)
return

print("UPDATING", directory)
self.update(directory)
7 changes: 3 additions & 4 deletions src/engine/src/helpers/TemplateMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
TapisActorTask
)

from pprint import pprint

class TemplateMapper:
def __init__(self, cache_dir: str):
Expand All @@ -37,8 +36,7 @@ def map(self, obj: Union[Pipeline, Task], uses: Uses) -> Union[Pipeline, Task]:

# Clone git repository specified on the pipeline.uses if exists
template = self.template_repo.get_by_uses(uses)
print("TEMPLATE TO BE MAPPED")
pprint(template)

# Resolve which class the final object should have
obj_class = Pipeline
if not issubclass(obj.__class__, Pipeline):
Expand Down Expand Up @@ -81,4 +79,5 @@ def map(self, obj: Union[Pipeline, Task], uses: Uses) -> Union[Pipeline, Task]:
if getattr(obj, attr) != updated_value:
setattr(obj, attr, updated_value)

return obj
return obj

0 comments on commit a4a2b23

Please sign in to comment.