From aca7c439b3453233a59ede5c3f0da8b109b5abed Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 4 Dec 2023 16:18:40 -0500 Subject: [PATCH 1/3] refactor: remove desired.jira-* attribute we no longer use --- openedx_webhooks/tasks/pr_tracking.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/openedx_webhooks/tasks/pr_tracking.py b/openedx_webhooks/tasks/pr_tracking.py index 26933c2f..a3462dad 100644 --- a/openedx_webhooks/tasks/pr_tracking.py +++ b/openedx_webhooks/tasks/pr_tracking.py @@ -135,17 +135,12 @@ class PrDesiredInfo: bot_comments: Set[BotComment] = field(default_factory=set) bot_comments_to_remove: Set[BotComment] = field(default_factory=set) - jira_project: Optional[str] = None jira_title: Optional[str] = None jira_description: Optional[str] = None # The Jira instances we want to have issues on. jira_nicks: Set[str] = field(default_factory=set) - # The Jira status we want to set on an existing issue. Can be None if we - # don't need to force a new status, but can leave the existing status. - jira_status: Optional[str] = None - # The bot-controlled labels we want to on the pull request. # See labels.py:CATEGORY_LABELS github_labels: Set[str] = field(default_factory=set) @@ -286,11 +281,7 @@ def desired_support_state(pr: PrDict) -> PrDesiredInfo: if not has_signed_agreement: desired.bot_comments.add(BotComment.NEED_CLA) - if state == "closed": - desired.jira_status = "Rejected" - elif state == "merged": - desired.jira_status = "Merged" - elif state == "reopened": + if state == "reopened": desired.bot_comments_to_remove.add(BotComment.SURVEY) if state in ["closed", "merged"]: From ad35ab8863eed96b1e859f596f7b5eb298572ab6 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 4 Dec 2023 16:24:20 -0500 Subject: [PATCH 2/3] refactor: delete an unused bin program --- Makefile | 2 +- bin/get_task_result_errors.py | 46 ----------------------------------- 2 files changed, 1 insertion(+), 47 deletions(-) delete mode 100755 bin/get_task_result_errors.py diff --git a/Makefile b/Makefile index 5da40636..ae12f9a1 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ test-html-coverage-report: test ## Run tests and show coverage report in browser open htmlcov/index.html pylint: ## Run pylint - -pylint --rcfile=pylintrc openedx_webhooks tests bin setup.py + -pylint --rcfile=pylintrc openedx_webhooks tests setup.py TYPEABLE = openedx_webhooks tests mypy: ## Run mypy to check type annotations diff --git a/bin/get_task_result_errors.py b/bin/get_task_result_errors.py deleted file mode 100755 index 5c9638e0..00000000 --- a/bin/get_task_result_errors.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python - -import csv -import json -import os - -import click -import redis - -click.disable_unicode_literals_warning = True - - -def get_result_for_key(log, key): - result = json.loads(log.get(key)) - result['job_id'] = key - return result - - -def failed(result): - return result['status'] != 'SUCCESS' - - -@click.command() -@click.argument('redis-url') -@click.argument('output-csv') -def cli(redis_url, output_csv): - """ - Get all failed task status from Celery Redis backend. - """ - log = redis.from_url(redis_url) - outfile = os.path.abspath(os.path.expanduser(output_csv)) - - with open(outfile, 'w') as csvfile: - fieldnames = ['job_id', 'status', 'result', 'traceback', 'children'] - writer = csv.DictWriter(csvfile, fieldnames=fieldnames) - writer.writeheader() - - all_results = [get_result_for_key(log, k) for k in log.keys('*')] - failed_results = [r for r in all_results if failed(r)] - - for result in failed_results: - writer.writerow(result) - - -if __name__ == '__main__': - cli() From 56e181d4bd6640780b7ee6e69bd9e0523f9910aa Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 4 Dec 2023 16:24:54 -0500 Subject: [PATCH 3/3] refactor: remove unused import --- tests/test_pull_request_opened.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_pull_request_opened.py b/tests/test_pull_request_opened.py index 347659aa..e1dd1300 100644 --- a/tests/test_pull_request_opened.py +++ b/tests/test_pull_request_opened.py @@ -18,7 +18,6 @@ ) from openedx_webhooks import settings from openedx_webhooks.gh_projects import pull_request_projects -from openedx_webhooks.info import get_jira_server_info from openedx_webhooks.tasks.github import pull_request_changed from .helpers import check_issue_link_in_markdown