You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by kn...@apache.org on 2021/05/19 08:10:08 UTC
[flink-jira-bot] 46/47: [FLINK-22569] limit number of tickets
touched by the bot per run to 100
This is an automated email from the ASF dual-hosted git repository.
knaufk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
commit 59c16f595514c67983965d9580c7c0f45eebcaaf
Author: Konstantin Knauf <kn...@gmail.com>
AuthorDate: Tue May 18 19:16:33 2021 +0200
[FLINK-22569] limit number of tickets touched by the bot per run to 100
---
config.yaml | 5 +++++
flink_jira_rule.py | 17 +++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/config.yaml b/config.yaml
index 50091da..f8aa8cf 100644
--- a/config.yaml
+++ b/config.yaml
@@ -17,6 +17,7 @@
################################################################################
stale_assigned:
+ ticket_limit: 10
stale_days: 14
warning_days: 7
warning_label: "stale-assigned"
@@ -30,6 +31,7 @@ stale_assigned:
This issue was marked "{warning_label}" {warning_days} ago and has not received an update. I have automatically removed the current assignee from the issue so others in the community may pick it up. If you are still working on this ticket, please ask a committer to reassign you and provide an update about your current status.
stale_minor:
+ ticket_limit: 10
stale_days: 180
warning_days: 7
warning_label: "stale-minor"
@@ -41,6 +43,7 @@ stale_minor:
This issue was labeled "{warning_label}" {warning_days} ago and has not received any updates so I have gone ahead and closed it. If you are still affected by this or would like to raise the priority of this ticket please re-open, removing the label "{done_label}" and raise the ticket priority accordingly.
stale_blocker:
+ ticket_limit: 5
stale_days: 1
warning_days: 7
warning_label: "stale-blocker"
@@ -52,6 +55,7 @@ stale_blocker:
This issue was labeled "{warning_label}" {warning_days} ago and has not received any updates so it is being deprioritized. If this ticket is actually a Blocker, please raise the priority and ask a committer to assign you the issue or revive the public discussion.
stale_critical:
+ ticket_limit: 10
stale_days: 7
warning_days: 7
warning_label: "stale-critical"
@@ -63,6 +67,7 @@ stale_critical:
This issue was labeled "{warning_label}" {warning_days} ago and has not received any updates so it is being deprioritized. If this ticket is actually Critical, please raise the priority and ask a committer to assign you the issue or revive the public discussion.
stale_major:
+ ticket_limit: 15
stale_days: 30
warning_days: 7
warning_label: "stale-major"
diff --git a/flink_jira_rule.py b/flink_jira_rule.py
index 3f784d7..f70ca3d 100644
--- a/flink_jira_rule.py
+++ b/flink_jira_rule.py
@@ -32,8 +32,9 @@ class FlinkJiraRule:
self.done_label = config["done_label"].get()
self.done_comment = config["done_comment"].get()
self.warning_comment = config["warning_comment"].get()
+ self.ticket_limit = config["ticket_limit"].get()
- def get_issues(self, jql_query):
+ def get_issues(self, jql_query, limit):
"""Queries the JIRA PI for all issues that match the given JQL Query
This method is necessary as requests tend to time out if the number of results reaches a certain number.
@@ -41,23 +42,23 @@ class FlinkJiraRule:
:param jql_query: the search query
:return: a list of issues matching the query
"""
- limit = 200
+ limit_per_api_request = min(100, limit)
current = 0
total = 1
issues = []
- while current < total:
- response = self.jira_client.jql(jql_query, limit=limit, start=current)
+ while current < min(total, limit):
+ response = self.jira_client.jql(jql_query, limit=limit_per_api_request, start=current)
total = response["total"]
issues = issues + response["issues"]
current = len(issues)
logging.info(f'"{jql_query}" returned {len(issues)} issues')
- return issues
+ return issues[:min(limit, len(issues))]
def has_recently_updated_subtask(self, parent, updated_within_days):
find_subtasks_updated_within = (
f"parent = {parent} AND updated > startOfDay(-{updated_within_days}d)"
)
- issues = self.get_issues(find_subtasks_updated_within)
+ issues = self.get_issues(find_subtasks_updated_within, 1)
return len(issues) > 0
def add_label_with_comment(self, key, label, comment):
@@ -80,7 +81,7 @@ class FlinkJiraRule:
def mark_stale_tickets_stale(self, jql_query):
logging.info(f"Looking for stale tickets.")
- issues = self.get_issues(jql_query)
+ issues = self.get_issues(jql_query, self.ticket_limit)
for issue in issues:
key = issue["key"]
@@ -106,7 +107,7 @@ class FlinkJiraRule:
def handle_tickets_marked_stale(self, jql_query):
logging.info(f"Looking for ticket previously marked as {self.warning_label}.")
- issues = self.get_issues(jql_query)
+ issues = self.get_issues(jql_query, self.ticket_limit)
for issue in issues:
key = issue["key"]