Skip to content

Commit

Permalink
Merge pull request #2482 from chaoss/minor-deps-patch
Browse files Browse the repository at this point in the history
Fix old and bad method of getting absolute directory for cloned repos for the main dependency task
  • Loading branch information
sgoggins authored Aug 23, 2023
2 parents f8f546b + fc55bb6 commit 56520d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
16 changes: 5 additions & 11 deletions augur/tasks/git/dependency_tasks/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from augur.tasks.git.dependency_tasks.dependency_util import dependency_calculator as dep_calc

def generate_deps_data(session, repo_id, path):
"""Runs scc on repo and stores data in database
"""Runs deps modules on repo and stores data in database
:param repo_id: Repository ID
:param path: Absolute path of the Repostiory
"""
Expand Down Expand Up @@ -46,22 +46,16 @@ def generate_deps_data(session, repo_id, path):

session.logger.info(f"Inserted {len(deps)} dependencies for repo {repo_id}")

"""
def deps_model(session, repo_id,repo_git,repo_path,repo_name):
# Data collection and storage method
def deps_model(session, repo_id,repo_git,repo_group_id):
""" Data collection and storage method
"""
session.logger.info(f"This is the deps model repo: {repo_git}.")
#result = session.execute_sql(repo_path_sql)
result = re.search(r"https:\/\/(github\.com\/[A-Za-z0-9 \- _]+\/)([A-Za-z0-9 \- _ .]+)$", repo_git).groups()

relative_repo_path = f"{repo_group_id}/{result[0]}{result[1]}"
config = AugurConfig(session.logger, session)
absolute_repo_path = config.get_section("Facade")['repo_directory'] + relative_repo_path

generate_deps_data(session,repo_id, absolute_repo_path)
"""

def generate_scorecard(session,repo_id,path):
"""Runs scorecard on repo and stores data in database
Expand Down
11 changes: 10 additions & 1 deletion augur/tasks/git/dependency_tasks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from augur.tasks.init.celery_app import celery_app as celery
from augur.tasks.init.celery_app import AugurFacadeRepoCollectionTask, AugurCoreRepoCollectionTask
from augur.application.db.util import execute_session_query
from augur.tasks.git.util.facade_worker.facade_worker.utilitymethods import get_absolute_repo_path
from augur.application.config import AugurConfig


@celery.task(base=AugurFacadeRepoCollectionTask)
Expand All @@ -21,7 +23,14 @@ def process_dependency_metrics(repo_git):


repo = execute_session_query(query,'one')
deps_model(session, repo.repo_id,repo_git,repo.repo_group_id)

config = AugurConfig(session.logger, session)

absolute_repo_path = get_absolute_repo_path(config.get_section("Facade")['repo_directory'],repo.repo_id,repo.repo_path,repo.repo_name)

session.logger.debug(f"This is the deps model repo: {repo_git}.")

generate_deps_data(session,repo.repo_id,absolute_repo_path)


@celery.task(base=AugurCoreRepoCollectionTask)
Expand Down

0 comments on commit 56520d3

Please sign in to comment.