-
Notifications
You must be signed in to change notification settings - Fork 850
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
Pr file patch into MAIN #2806
Pr file patch into MAIN #2806
Changes from all commits
a11097a
793e100
0cc6a54
4a18742
b230d73
f296a07
8663655
ca6cb79
0de7fdd
85bd70f
e9b83c6
b244c60
478048d
e1f9950
f50d124
f55ed92
d4e2762
6e98367
8f596cc
f6d5680
03fc1fe
2241f33
16f6d6b
fcbb819
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,7 +132,7 @@ def determine_worker_processes(ratio,maximum): | |
sleep_time += 6 | ||
|
||
#20% of estimate, Maximum value of 25 | ||
secondary_num_processes = determine_worker_processes(.25, 25) | ||
secondary_num_processes = determine_worker_processes(.25, 45) | ||
logger.info(f"Starting secondary worker processes with concurrency={secondary_num_processes}") | ||
secondary_worker = f"celery -A augur.tasks.init.celery_app.celery_app worker -l info --concurrency={secondary_num_processes} -n secondary:{uuid.uuid4().hex}@%h -Q secondary" | ||
process_list.append(subprocess.Popen(secondary_worker.split(" "))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ def start(): | |
|
||
scheduling_worker = f"celery -A augur.tasks.init.celery_app.celery_app worker -l info --concurrency=1 -n scheduling:{uuid.uuid4().hex}@%h -Q scheduling" | ||
core_worker = f"celery -A augur.tasks.init.celery_app.celery_app worker -l info --concurrency=45 -n core:{uuid.uuid4().hex}@%h" | ||
secondary_worker = f"celery -A augur.tasks.init.celery_app.celery_app worker -l info --concurrency=25 -n secondary:{uuid.uuid4().hex}@%h -Q secondary" | ||
secondary_worker = f"celery -A augur.tasks.init.celery_app.celery_app worker -l info --concurrency=45 -n secondary:{uuid.uuid4().hex}@%h -Q secondary" | ||
|
||
scheduling_worker_process = subprocess.Popen(scheduling_worker.split(" ")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶 |
||
core_worker_process = subprocess.Popen(core_worker.split(" ")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ | |
from augur.application.db.util import execute_session_query | ||
from ..messages.tasks import process_github_comment_contributors | ||
|
||
from typing import Generator, List, Dict | ||
|
||
|
||
platform_id = 1 | ||
|
||
|
@@ -29,20 +31,32 @@ def collect_pull_requests(repo_git: str) -> int: | |
Repo.repo_git == repo_git).one().repo_id | ||
|
||
owner, repo = get_owner_repo(repo_git) | ||
pr_data = retrieve_all_pr_data(repo_git, logger, manifest.key_auth) | ||
|
||
if pr_data: | ||
process_pull_requests(pr_data, f"{owner}/{repo}: Pr task", repo_id, logger, augur_db) | ||
total_count = 0 | ||
all_data = [] | ||
for page in retrieve_all_pr_data(repo_git, logger, manifest.key_auth): | ||
all_data += page | ||
|
||
if len(all_data) >= 1000: | ||
process_pull_requests(all_data, f"{owner}/{repo}: Pr task", repo_id, logger, augur_db) | ||
total_count += len(all_data) | ||
all_data.clear() | ||
|
||
if len(all_data): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶 |
||
process_pull_requests(all_data, f"{owner}/{repo}: Pr task", repo_id, logger, augur_db) | ||
total_count += len(all_data) | ||
|
||
return len(pr_data) | ||
if total_count > 0: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶 |
||
return total_count | ||
else: | ||
logger.info(f"{owner}/{repo} has no pull requests") | ||
return 0 | ||
|
||
|
||
|
||
# TODO: Rename pull_request_reviewers table to pull_request_requested_reviewers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶 |
||
# TODO: Fix column names in pull request labels table | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶 |
||
def retrieve_all_pr_data(repo_git: str, logger, key_auth) -> None: | ||
def retrieve_all_pr_data(repo_git: str, logger, key_auth): #-> Generator[List[Dict]]: | ||
|
||
owner, repo = get_owner_repo(repo_git) | ||
|
||
|
@@ -52,24 +66,21 @@ def retrieve_all_pr_data(repo_git: str, logger, key_auth) -> None: | |
# returns an iterable of all prs at this url (this essentially means you can treat the prs variable as a list of the prs) | ||
prs = GithubPaginator(url, key_auth, logger) | ||
|
||
all_data = [] | ||
num_pages = prs.get_num_pages() | ||
for page_data, page in prs.iter_pages(): | ||
|
||
if page_data is None: | ||
return all_data | ||
return | ||
|
||
if len(page_data) == 0: | ||
logger.debug( | ||
f"{owner}/{repo} Prs Page {page} contains no data...returning") | ||
logger.info(f"{owner}/{repo} Prs Page {page} of {num_pages}") | ||
return all_data | ||
return | ||
|
||
logger.info(f"{owner}/{repo} Prs Page {page} of {num_pages}") | ||
|
||
all_data += page_data | ||
|
||
return all_data | ||
|
||
yield page_data | ||
|
||
|
||
def process_pull_requests(pull_requests, task_name, repo_id, logger, augur_db): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶 |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
R1732: Consider using 'with' for resource-allocating operations (consider-using-with)