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

Collect smallest repos first on initial collection #2983

Merged
merged 1 commit into from
Feb 5, 2025
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
5 changes: 4 additions & 1 deletion 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 @@ -154,11 +154,14 @@
def get_newly_added_repos(session, limit, hook):

condition_string = ""
order_by_field = ""
if hook in ["core", "secondary", "ml"]:
condition_string += f"""{hook}_status='{str(CollectionState.PENDING.value)}'"""
order_by_field = "issue_pr_sum"

elif hook == "facade":
condition_string += f"""facade_status='{str(CollectionState.UPDATE.value)}'"""
order_by_field = "commit_sum"

if hook == "secondary":
condition_string += f""" and core_status='{str(CollectionState.SUCCESS.value)}'"""
Expand All @@ -168,7 +171,7 @@
from augur_operations.collection_status x, augur_data.repo y
where x.repo_id=y.repo_id
and {condition_string}
order by repo_added
order by {order_by_field}
limit :limit_num
""").bindparams(limit_num=limit)

Expand Down Expand Up @@ -258,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 @@ -330,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 @@ -397,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