sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #07560
[Merge] ~ack/maas-kpi:filter-maas-ui-project into maas-kpi:master
Alberto Donato has proposed merging ~ack/maas-kpi:filter-maas-ui-project into maas-kpi:master.
Commit message:
filter bugs targeted to maas-ui project too for maas
Requested reviews:
MAAS Committers (maas-committers)
MAAS Lander (maas-lander)
For more details, see:
https://code.launchpad.net/~ack/maas-kpi/+git/maas-kpi/+merge/441860
--
Your team MAAS Committers is requested to review the proposed merge of ~ack/maas-kpi:filter-maas-ui-project into maas-kpi:master.
diff --git a/maaskpi/bugs.py b/maaskpi/bugs.py
index 478c3fc..6bf25d4 100644
--- a/maaskpi/bugs.py
+++ b/maaskpi/bugs.py
@@ -34,31 +34,45 @@ class BugsCollector(LaunchpadCollector):
same as the Launchpad statuses, except Incomplete is divided into
IncompleteWithResponse and IncompleteWithoutResponse.
- The project label can be either 'core' or 'ui', indicating which
- team the bug belongs to.
+ If `ignored_related_projects` is provided, a task which is related to tasks
+ in those projects will not be included in the count.
+
+ The project label can be either 'core' or 'ui', indicating which team the
+ bug belongs to.
+
"""
- def _collect_open_bugs(self, record_series, sub_project: str, tasks):
- open_bugs = dict.fromkeys(record_series.Meta.fields, 0)
- for bug_task in tasks:
- status = bug_task.status
+ def _collect_bugs(
+ self, record_series, lp_project, project_label, ignored_related_projects=()
+ ):
+ counts = dict.fromkeys(record_series.Meta.fields, 0)
+ for task in lp_project.searchTasks():
+ ignore = ignored_related_projects and any(
+ related_task.target in ignored_related_projects
+ for related_task in task.related_tasks
+ )
+ if ignore:
+ continue
+
+ status = task.status
if status == "Incomplete":
- if bug_task.date_incomplete < bug_task.bug.date_last_message:
+ if task.date_incomplete < task.bug.date_last_message:
status += "WithResponse"
else:
status += "WithoutResponse"
-
- open_bugs[status_to_field(status)] += 1
+ counts[status_to_field(status)] += 1
# influx mutates state in the class via the constructor
- record_series(**open_bugs, project=sub_project)
+ record_series(**counts, project=project_label)
def collect(self, lp):
- maas = lp.projects["maas"]
print("Searching tasks....")
- core_tasks = maas.searchTasks(tags=["-ui"])
- ui_tasks = maas.searchTasks(tags=["ui"])
- for sub_project, tasks in [("core", core_tasks), ("ui", ui_tasks)]:
- self._collect_open_bugs(OpenBugsSeries, sub_project, tasks)
+ self._collect_bugs(
+ OpenBugsSeries,
+ lp.projects["maas"],
+ "core",
+ ignored_related_projects=[lp.projects["maas-ui"]],
+ )
+ self._collect_bugs(OpenBugsSeries, lp.projects["maas-ui"], "ui")
yield OpenBugsSeries
Follow ups