From 55dc5e5c3436c984bce189534a885c4dc2ae85c2 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Fri, 6 Jan 2023 16:32:50 +0000 Subject: [PATCH 1/8] Allow VS2010 directory to be renamed Signed-off-by: Dave Rodgman --- resources/windows/windows_testing.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/windows/windows_testing.py b/resources/windows/windows_testing.py index 5df6a9d88..039247d64 100644 --- a/resources/windows/windows_testing.py +++ b/resources/windows/windows_testing.py @@ -37,6 +37,7 @@ import shutil import sys import traceback +import glob class VStestrun(object): @@ -581,9 +582,8 @@ def test_visual_studio_built_code(self, test_run, solution_type): git_worktree_path, test_run, vs_logger ) else: - solution_dir = os.path.join( - git_worktree_path, "visualc", "VS2010" - ) + solution_dir = glob.glob(os.path.join( + git_worktree_path, "visualc", "VS*"))[0] build_result = self.build_code_using_visual_studio( solution_dir, test_run, solution_type, vs_logger, c89 ) From 005d39e11805552b72d62c4ea106dd8b8675c144 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 6 Apr 2023 11:55:15 +0100 Subject: [PATCH 2/8] Fix error using pickle Signed-off-by: Dave Rodgman --- pr-metrics/get-pr-data.py | 14 ++++++++++++-- pr-metrics/prs.py | 11 ++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/pr-metrics/get-pr-data.py b/pr-metrics/get-pr-data.py index 717ec4b31..45401189c 100755 --- a/pr-metrics/get-pr-data.py +++ b/pr-metrics/get-pr-data.py @@ -3,8 +3,9 @@ """Get PR data from github and pickle it.""" -import pickle import os +import requests.exceptions +import time from github import Github @@ -38,4 +39,13 @@ p.update() with open("pr-data.p", "wb") as f: - pickle.dump(prs, f) + for i, p in enumerate(prs): + for retry in range(0, 9): + try: + g.dump(p, f) + break + except requests.exceptions.ReadTimeout: + delay = 2 ** retry + print(f"timeout; sleeping {delay} s and retrying...") + time.sleep(2 ** delay) + print(f"saved {i+1}/{len(prs)}") diff --git a/pr-metrics/prs.py b/pr-metrics/prs.py index a436d7e27..decd1d87c 100644 --- a/pr-metrics/prs.py +++ b/pr-metrics/prs.py @@ -3,13 +3,18 @@ """PR data an misc common functions.""" -import pickle import datetime import os +from github import Github +prs = [] with open("pr-data.p", "rb") as f: - prs = pickle.load(f) - + g = Github() + try: + while True: + prs.append(g.load(f)) + except EOFError: + pass # Current and past core contributors, alphabetical order (sort -f). # From 1013e4be92be6f0be202bf9d3ba4b31ea1e66ef9 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 6 Apr 2023 14:47:00 +0100 Subject: [PATCH 3/8] Convert pr-backlog to have arbitary set of thresholds Signed-off-by: Dave Rodgman --- pr-metrics/pr-backlog.py | 42 +++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/pr-metrics/pr-backlog.py b/pr-metrics/pr-backlog.py index f3634221f..6a3f0c839 100755 --- a/pr-metrics/pr-backlog.py +++ b/pr-metrics/pr-backlog.py @@ -11,12 +11,10 @@ import matplotlib.pyplot as plt -new_days = 90 -old_days = 365 +# Group PRs by age, according to these thresholds +thresholds = [90, 365, 365 * 1000] -new = Counter() -med = Counter() -old = Counter() +counters = {t: Counter() for t in thresholds} for beg, end, com in pr_dates(): if end is None: @@ -30,33 +28,28 @@ # Only count on each quarter's last day if q == q1: continue - if i <= new_days: - new[q] += 1 - elif i <= old_days: - med[q] += 1 - else: - old[q] += 1 + for t in thresholds: + if i <= t: + counters[t][q] += 1 + break first_q = quarter(first) last_q = quarter(last) -quarters = (q for q in chain(new, med, old) if first_q <= q <= last_q) +quarters = (q for q in chain(*counters.values()) if first_q <= q <= last_q) quarters = tuple(sorted(set(quarters))) -new_y = tuple(new[q] for q in quarters) -med_y = tuple(med[q] for q in quarters) -old_y = tuple(old[q] for q in quarters) -sum_y = tuple(old[q] + med[q] for q in quarters) +buckets_y = {t: tuple(counters[t][q] for q in quarters) for t in thresholds} -old_name = "older than {} days".format(old_days) -med_name = "medium" -new_name = "recent (less {} days old)".format(new_days) +names = {t: f"<= {t} days" for t in thresholds} +names[thresholds[-1]] = f"> {thresholds[-2]} days" width = 0.9 fig, ax = plt.subplots() -ax.bar(quarters, old_y, width, label=old_name) -ax.bar(quarters, med_y, width, label=med_name, bottom=old_y) -ax.bar(quarters, new_y, width, label=new_name, bottom=sum_y) +prev_tops=[0] * len(quarters) +for t in reversed(thresholds): + ax.bar(quarters, buckets_y[t], width, label=names[t], bottom=prev_tops) + prev_tops = [a + b for a,b in zip(prev_tops, buckets_y[t])] ax.legend(loc="upper left") ax.grid(True) ax.set_xlabel("quarter") @@ -68,5 +61,6 @@ print("Quarter,recent,medium,old,total") for q in quarters: - print("{},{},{},{},{}".format(q, new[q], med[q], old[q], - new[q] + med[q] + old[q])) + s = ", ".join(str(counters[t][q]) for t in thresholds) + t = sum(counters[t][q] for t in thresholds) + print(f"{q}, {s}, {t}") From 7fbe1df2ceaff2900994600ce54fb7c1d2a5b45c Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 6 Apr 2023 14:52:48 +0100 Subject: [PATCH 4/8] Adjust thresholds; improve labelling Signed-off-by: Dave Rodgman --- pr-metrics/pr-backlog.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pr-metrics/pr-backlog.py b/pr-metrics/pr-backlog.py index 6a3f0c839..2ad048756 100755 --- a/pr-metrics/pr-backlog.py +++ b/pr-metrics/pr-backlog.py @@ -12,7 +12,7 @@ import matplotlib.pyplot as plt # Group PRs by age, according to these thresholds -thresholds = [90, 365, 365 * 1000] +thresholds = [15, 90, 180, 365, 365 * 1000] counters = {t: Counter() for t in thresholds} @@ -41,7 +41,10 @@ buckets_y = {t: tuple(counters[t][q] for q in quarters) for t in thresholds} -names = {t: f"<= {t} days" for t in thresholds} +names = {t: None} #f"<= {t} days" for t in thresholds} +names[thresholds[0]] = f"<= {thresholds[0]} days" +for i in range(1, len(thresholds)): + names[thresholds[i]] = f"{thresholds[i-1] + 1}..{thresholds[i]} days" names[thresholds[-1]] = f"> {thresholds[-2]} days" width = 0.9 From 379d144b1c6557d4e279a6adbdfa1ed2188dc2b2 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 6 Apr 2023 15:02:04 +0100 Subject: [PATCH 5/8] Improve graph labelling Signed-off-by: Dave Rodgman --- pr-metrics/pr-backlog.py | 6 +++--- pr-metrics/prs.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pr-metrics/pr-backlog.py b/pr-metrics/pr-backlog.py index 2ad048756..deb4494ce 100755 --- a/pr-metrics/pr-backlog.py +++ b/pr-metrics/pr-backlog.py @@ -55,10 +55,10 @@ prev_tops = [a + b for a,b in zip(prev_tops, buckets_y[t])] ax.legend(loc="upper left") ax.grid(True) -ax.set_xlabel("quarter") -ax.set_ylabel("Number or PRs pending") +#ax.set_xlabel("quarter") +ax.set_ylabel("Open PR count") ax.tick_params(axis="x", labelrotation=90) -fig.suptitle("State of the PR backlog at the end of each quarter") +fig.suptitle("Open PR count, broken down by PR age") fig.set_size_inches(12.8, 7.2) # default 100 dpi -> 720p fig.savefig("prs-backlog.png") diff --git a/pr-metrics/prs.py b/pr-metrics/prs.py index decd1d87c..e93a57a87 100644 --- a/pr-metrics/prs.py +++ b/pr-metrics/prs.py @@ -91,7 +91,7 @@ def is_community(pr): def quarter(date): """Return a string decribing this date's quarter, for example 19q3.""" q = str(date.year % 100) - q += "q" + q += " Q" q += str((date.month + 2) // 3) return q From 6c1897e6878fb0cca9b6b10beda9ed696b8d9087 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 3 Oct 2023 13:23:02 +0100 Subject: [PATCH 6/8] Revert "Fix error using pickle" This reverts commit 005d39e11805552b72d62c4ea106dd8b8675c144. --- pr-metrics/get-pr-data.py | 14 ++------------ pr-metrics/prs.py | 11 +++-------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/pr-metrics/get-pr-data.py b/pr-metrics/get-pr-data.py index 45401189c..717ec4b31 100755 --- a/pr-metrics/get-pr-data.py +++ b/pr-metrics/get-pr-data.py @@ -3,9 +3,8 @@ """Get PR data from github and pickle it.""" +import pickle import os -import requests.exceptions -import time from github import Github @@ -39,13 +38,4 @@ p.update() with open("pr-data.p", "wb") as f: - for i, p in enumerate(prs): - for retry in range(0, 9): - try: - g.dump(p, f) - break - except requests.exceptions.ReadTimeout: - delay = 2 ** retry - print(f"timeout; sleeping {delay} s and retrying...") - time.sleep(2 ** delay) - print(f"saved {i+1}/{len(prs)}") + pickle.dump(prs, f) diff --git a/pr-metrics/prs.py b/pr-metrics/prs.py index e93a57a87..bb3b57813 100644 --- a/pr-metrics/prs.py +++ b/pr-metrics/prs.py @@ -3,18 +3,13 @@ """PR data an misc common functions.""" +import pickle import datetime import os -from github import Github -prs = [] with open("pr-data.p", "rb") as f: - g = Github() - try: - while True: - prs.append(g.load(f)) - except EOFError: - pass + prs = pickle.load(f) + # Current and past core contributors, alphabetical order (sort -f). # From 0fdcd8f7b9c315bda8a39a565b3d994abc5f2337 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 3 Oct 2023 13:45:21 +0100 Subject: [PATCH 7/8] Exclude draft PRs Signed-off-by: Dave Rodgman --- pr-metrics/get-pr-data.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pr-metrics/get-pr-data.py b/pr-metrics/get-pr-data.py index 717ec4b31..7c9bd68d5 100755 --- a/pr-metrics/get-pr-data.py +++ b/pr-metrics/get-pr-data.py @@ -18,6 +18,8 @@ prs = list() for p in r.get_pulls(state="all"): + if p.draft: + continue print(p.number) # Accessing p.mergeable forces completion of PR data (by default, only # basic info such as status and dates is available) but makes things From d6844ed78f7ed57c13658bfad81ecd88f48e4749 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 3 Oct 2023 13:53:15 +0100 Subject: [PATCH 8/8] Update list of team members Signed-off-by: Dave Rodgman --- pr-metrics/prs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pr-metrics/prs.py b/pr-metrics/prs.py index bb3b57813..58ba67541 100644 --- a/pr-metrics/prs.py +++ b/pr-metrics/prs.py @@ -33,6 +33,7 @@ "dgreen-arm", "gabor-mezei-arm", "gilles-peskine-arm", + "gowthamsk-arm", "hanno-arm", "hanno-becker", "jackbondpreston-arm", @@ -55,12 +56,14 @@ "RcColes", "ronald-cron-arm", "RonEld", + "Ryan-Everett-arm", "sbutcher-arm", "shanechko", "silabs-hannes", "silabs-Kusumit", "silabs-Saketh", "superna9999", + "tgonzalezorlandoarm", "tom-cosgrove-arm", "tom-daubney-arm", "tuvshinzayaArm",