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

Fix a few small collection issues #2667

Merged
merged 3 commits into from
Jan 23, 2024
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
3 changes: 2 additions & 1 deletion augur/tasks/github/messages/tasks.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import time

Check warning on line 1 in augur/tasks/github/messages/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 C0114: Missing module docstring (missing-module-docstring) Raw Output: augur/tasks/github/messages/tasks.py:1:0: C0114: Missing module docstring (missing-module-docstring)
import logging

import traceback

from augur.tasks.init.celery_app import celery_app as celery
from augur.tasks.init.celery_app import AugurCoreRepoCollectionTask
from augur.application.db.data_parse import *

Check warning on line 8 in augur/tasks/github/messages/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0401: Wildcard import augur.application.db.data_parse (wildcard-import) Raw Output: augur/tasks/github/messages/tasks.py:8:0: W0401: Wildcard import augur.application.db.data_parse (wildcard-import)
from augur.tasks.github.util.github_paginator import GithubPaginator, hit_api
from augur.tasks.github.util.github_task_session import GithubTaskManifest
from augur.application.db.session import DatabaseSession
Expand All @@ -20,7 +20,7 @@


@celery.task(base=AugurCoreRepoCollectionTask)
def collect_github_messages(repo_git: str) -> None:

Check warning on line 23 in augur/tasks/github/messages/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 C0116: Missing function or method docstring (missing-function-docstring) Raw Output: augur/tasks/github/messages/tasks.py:23:0: C0116: Missing function or method docstring (missing-function-docstring)

logger = logging.getLogger(collect_github_messages.__name__)

Expand All @@ -44,7 +44,7 @@



def retrieve_all_pr_and_issue_messages(repo_git: str, logger, key_auth, task_name) -> None:

Check warning on line 47 in augur/tasks/github/messages/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 C0116: Missing function or method docstring (missing-function-docstring) Raw Output: augur/tasks/github/messages/tasks.py:47:0: C0116: Missing function or method docstring (missing-function-docstring)

owner, repo = get_owner_repo(repo_git)

Expand All @@ -66,7 +66,7 @@
all_data = []
for page_data, page in messages.iter_pages():

if page_data is None:

Check warning on line 69 in augur/tasks/github/messages/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return) Raw Output: augur/tasks/github/messages/tasks.py:69:8: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
return all_data

elif len(page_data) == 0:
Expand All @@ -83,7 +83,7 @@
return all_data


def process_messages(messages, task_name, repo_id, logger, augur_db):

Check warning on line 86 in augur/tasks/github/messages/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 C0116: Missing function or method docstring (missing-function-docstring) Raw Output: augur/tasks/github/messages/tasks.py:86:0: C0116: Missing function or method docstring (missing-function-docstring)

Check warning on line 86 in augur/tasks/github/messages/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 R0914: Too many local variables (39/30) (too-many-locals) Raw Output: augur/tasks/github/messages/tasks.py:86:0: R0914: Too many local variables (39/30) (too-many-locals)

Check warning on line 86 in augur/tasks/github/messages/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 R0912: Too many branches (18/12) (too-many-branches) Raw Output: augur/tasks/github/messages/tasks.py:86:0: R0912: Too many branches (18/12) (too-many-branches)

Check warning on line 86 in augur/tasks/github/messages/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 R0915: Too many statements (78/50) (too-many-statements) Raw Output: augur/tasks/github/messages/tasks.py:86:0: R0915: Too many statements (78/50) (too-many-statements)

tool_source = "Pr comment task"
tool_version = "2.0"
Expand Down Expand Up @@ -187,7 +187,8 @@
message_string_fields = ["msg_text"]
message_return_data = augur_db.insert_data(message_dicts, Message, message_natural_keys,
return_columns=message_return_columns, string_fields=message_string_fields)

if message_return_data is None:
return

pr_message_ref_dicts = []
issue_message_ref_dicts = []
Expand Down Expand Up @@ -216,7 +217,7 @@
logger.info(f"{task_name}: Inserted {len(message_dicts)} messages. {len(issue_message_ref_dicts)} from issues and {len(pr_message_ref_dicts)} from prs")


def is_issue_message(html_url):

Check warning on line 220 in augur/tasks/github/messages/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 C0116: Missing function or method docstring (missing-function-docstring) Raw Output: augur/tasks/github/messages/tasks.py:220:0: C0116: Missing function or method docstring (missing-function-docstring)

return '/pull/' not in html_url

Expand Down
3 changes: 2 additions & 1 deletion augur/tasks/github/releases/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def insert_release(augur_db, logger, repo_id, owner, release, tag_only = False):
release_inf = get_release_inf(repo_id, release, tag_only)

#Do an upsert
augur_db.insert_data(release_inf,Release,['release_id'])
string_fields = ["release_name", "release_description", "release_author", "release_tag_name"]
augur_db.insert_data(release_inf,Release,['release_id'], string_fields=string_fields)

logger.info(f"Inserted info for {owner}/{repo_id}/{release['name']}\n")

Expand Down
2 changes: 1 addition & 1 deletion augur/tasks/util/worker_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def parse_json_from_subprocess_call(logger, subprocess_arr, cwd=None):
try:
required_output = json.loads(output)
except json.decoder.JSONDecodeError as e:
session.logger.error(f"Could not parse required output! \n output: {output} \n Error: {e}")
logger.error(f"Could not parse required output! \n output: {output} \n Error: {e}")
raise e

return required_output
Expand Down
Loading