Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev facade fixes #2165

Merged
merged 2 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions augur/tasks/git/facade_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,9 @@ def analyze_commits_in_parallel(repo_ids, multithreaded: bool)-> None:
@celery.task
def nuke_affiliations_facade_task():
logger = logging.getLogger(nuke_affiliations_facade_task.__name__)
# TODO: Is this session ever closed?
session = FacadeSession(logger)

nuke_affiliations(session)

with FacadeSession(logger) as session:
nuke_affiliations(session)

@celery.task
def fill_empty_affiliations_facade_task():
Expand Down Expand Up @@ -462,7 +461,7 @@ def generate_contributor_sequence(logger,repo_git_identifiers):



def generate_facade_chain(logger,repo_git_identifiers):
def generate_facade_chain(logger,repo_git_identifiers, firstRun=False):
#raise NotImplemented

logger.info("Generating facade sequence")
Expand Down Expand Up @@ -514,17 +513,17 @@ def generate_facade_chain(logger,repo_git_identifiers):
#Generate contributor analysis task group.
facade_sequence.append(generate_contributor_sequence(logger,repo_git_identifiers))

if nuke_stored_affiliations:
if nuke_stored_affiliations and firstRun:
facade_sequence.append(nuke_affiliations_facade_task.si().on_error(facade_error_handler.s()))#nuke_affiliations(session.cfg)

#session.logger.info(session.cfg)
if not limited_run or (limited_run and fix_affiliations):
if not limited_run or (limited_run and fix_affiliations) and firstRun:
facade_sequence.append(fill_empty_affiliations_facade_task.si().on_error(facade_error_handler.s()))#fill_empty_affiliations(session)

if force_invalidate_caches:
if force_invalidate_caches and firstRun:
facade_sequence.append(invalidate_caches_facade_task.si().on_error(facade_error_handler.s()))#invalidate_caches(session.cfg)

if not limited_run or (limited_run and rebuild_caches):
if not limited_run or (limited_run and rebuild_caches) and firstRun:
facade_sequence.append(rebuild_unknown_affiliation_and_web_caches_facade_task.si().on_error(facade_error_handler.s()))#rebuild_unknown_affiliation_and_web_caches(session.cfg)

logger.info(f"Facade sequence: {facade_sequence}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# else:
# import MySQLdb

def nuke_affiliations(session):
def nuke_affiliations(session, repo_id_list):

# Delete all stored affiliations in the database. Normally when you
# add/remove/change affiliation data via the web UI, any potentially affected
Expand All @@ -56,7 +56,8 @@ def nuke_affiliations(session):
session.log_activity('Info','Nuking affiliations')

nuke = s.sql.text("""UPDATE commits SET cmt_author_affiliation = NULL,
cmt_committer_affiliation = NULL""")
cmt_committer_affiliation = NULL
WHERE repo_id IN :values""").bindparams(values=tuple(repo_id_list))

session.execute_sql(nuke)

Expand Down
5 changes: 2 additions & 3 deletions augur/tasks/github/facade_github/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,9 @@ def link_commits_to_contributor(session,contributorQueue):
query = s.sql.text("""
UPDATE commits
SET cmt_ght_author_id=:cntrb_id
WHERE cmt_committer_email=:cntrb_email
OR cmt_author_raw_email=:cntrb_email
WHERE
cmt_author_raw_email=:cntrb_email
OR cmt_author_email=:cntrb_email
OR cmt_committer_raw_email=:cntrb_email
""").bindparams(cntrb_id=cntrb["cntrb_id"],cntrb_email=cntrb["email"])

#engine.execute(query, **data)
Expand Down
2 changes: 1 addition & 1 deletion augur/tasks/start_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def repo_collect_phase():
repo_task_group = group(
*repo_info_tasks,
chain(primary_repo_jobs,secondary_repo_jobs,process_contributors.si()),
chain(generate_facade_chain(logger,first_pass),create_grouped_task_load(dataList=first_pass,task=process_dependency_metrics)),
chain(generate_facade_chain(logger,first_pass,firstRun=True),create_grouped_task_load(dataList=first_pass,task=process_dependency_metrics)),
collect_releases.si()
)

Expand Down