Skip to content
Merged
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
62 changes: 29 additions & 33 deletions augur/tasks/util/collection_util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations
import logging
import random

Check warning on line 3 in augur/tasks/util/collection_util.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0611: Unused import random (unused-import) Raw Output: augur/tasks/util/collection_util.py:3:0: W0611: Unused import random (unused-import)
import datetime
#from celery.result import AsyncResult
from celery import chain
Expand Down Expand Up @@ -261,7 +261,7 @@

try:
collectionRecord = execute_session_query(query,'one')
except:

Check warning on line 264 in augur/tasks/util/collection_util.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0702: No exception type(s) specified (bare-except) Raw Output: augur/tasks/util/collection_util.py:264:8: W0702: No exception type(s) specified (bare-except)
#Exit if we can't find the record.
return

Expand Down Expand Up @@ -333,7 +333,7 @@
raw_count = status.issue_pr_sum

#Update the values for core and secondary weight
issue_pr_task_update_weight_util([int(raw_count)],repo_git=repo_git,session=session)

Check warning on line 336 in augur/tasks/util/collection_util.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 E1120: No value for argument 'issue_and_pr_nums' in function call (no-value-for-parameter) Raw Output: augur/tasks/util/collection_util.py:336:8: E1120: No value for argument 'issue_and_pr_nums' in function call (no-value-for-parameter)

#Update the existing core and secondary weights as well as the raw sum of issues and prs
def update_issue_pr_weights(logger,session,repo_git,raw_sum):
Expand Down Expand Up @@ -400,7 +400,7 @@
status = repo.collection_status[0]
raw_count = status.issue_pr_sum

issue_pr_task_update_weight_util([int(raw_count)],repo_git=repo_git,session=session)

Check warning on line 403 in augur/tasks/util/collection_util.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 E1120: No value for argument 'issue_and_pr_nums' in function call (no-value-for-parameter) Raw Output: augur/tasks/util/collection_util.py:403:8: E1120: No value for argument 'issue_and_pr_nums' in function call (no-value-for-parameter)

#Get the weight for each repo for the secondary collection hook.
def get_repo_weight_secondary(logger,repo_git):
Expand Down Expand Up @@ -597,37 +597,33 @@
for repo_git, full_collection in col_hook.repo_list:

repo = get_repo_by_repo_git(repo_git)
platform_name = "github"
# this needs to be here and not up a level since it should be set/reset for each repo.
# otherwise a gitlab repo would reset it and cause subsequent github repos to use gitlab phases.
phases = None
if "github" in repo.repo_git:
augur_collection_sequence = []
for job in col_hook.phases:
#Add the phase to the sequence in order as a celery task.
#The preliminary task creates the larger task chain
augur_collection_sequence.append(job(repo_git, full_collection))

#augur_collection_sequence.append(core_task_success_util.si(repo_git))
#Link all phases in a chain and send to celery
augur_collection_chain = chain(*augur_collection_sequence)
task_id = augur_collection_chain.apply_async().task_id

self.logger.info(f"Setting github repo {col_hook.name} status to collecting for repo: {repo_git}")

#yield the value of the task_id to the calling method so that the proper collectionStatus field can be updated
yield repo_git, task_id, col_hook.name
else:
if col_hook.gitlab_phases is not None:

augur_collection_sequence = []
for job in col_hook.gitlab_phases:
#Add the phase to the sequence in order as a celery task.
#The preliminary task creates the larger task chain
augur_collection_sequence.append(job(repo_git, full_collection))

#augur_collection_sequence.append(core_task_success_util.si(repo_git))
#Link all phases in a chain and send to celery
augur_collection_chain = chain(*augur_collection_sequence)
task_id = augur_collection_chain.apply_async().task_id

self.logger.info(f"Setting gitlab repo {col_hook.name} status to collecting for repo: {repo_git}")

#yield the value of the task_id to the calling method so that the proper collectionStatus field can be updated
yield repo_git, task_id, col_hook.name
phases = col_hook.phases
# use default platform name

elif "gitlab" in repo.repo_git:
platform_name = "gitlab"
if col_hook.gitlab_phases is None:
continue
phases = col_hook.gitlab_phases

augur_collection_sequence = []
for job in phases:
#Add the phase to the sequence in order as a celery task.
#The preliminary task creates the larger task chain
augur_collection_sequence.append(job(repo_git, full_collection))

#augur_collection_sequence.append(core_task_success_util.si(repo_git))
#Link all phases in a chain and send to celery
augur_collection_chain = chain(*augur_collection_sequence)
task_id = augur_collection_chain.apply_async().task_id

self.logger.info(f"Setting {platform_name} repo {col_hook.name} status to collecting for repo: {repo_git}")

#yield the value of the task_id to the calling method so that the proper collectionStatus field can be updated
yield repo_git, task_id, col_hook.name

Loading