[llvm] workflows/commit-access-reivew: Use concurrency to speed up script (PR #181204)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 10:49:33 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-github-workflow

Author: Tom Stellard (tstellar)

<details>
<summary>Changes</summary>

Making some of the graphql queries in parallel cuts the runtime of the script from ~60 minutes to ~40 minutes.

---
Full diff: https://github.com/llvm/llvm-project/pull/181204.diff


1 Files Affected:

- (modified) .github/workflows/commit-access-review.py (+7-6) 


``````````diff
diff --git a/.github/workflows/commit-access-review.py b/.github/workflows/commit-access-review.py
index 338bdcbca6607..a644928433096 100644
--- a/.github/workflows/commit-access-review.py
+++ b/.github/workflows/commit-access-review.py
@@ -9,6 +9,7 @@
 #
 # ===------------------------------------------------------------------------===#
 
+import concurrent.futures
 import datetime
 import github
 import re
@@ -291,9 +292,10 @@ def main():
         sys.exit(0)
 
     # Step 2 check for reviews
-    for user in list(triage_list.keys()):
-        review_count = get_review_count(gh, user, one_year_ago)
-        triage_list[user].add_reviewed(review_count)
+
+    # 4 because that's how many cores the default github runners have.
+    with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
+        executor.map(lambda user:triage_list[user].add_reviewed(get_review_count(gh, user, one_year_ago)), list(triage_list.keys()))
 
     print("After Reviews:", len(triage_list), "triagers")
 
@@ -301,11 +303,10 @@ def main():
         sys.exit(0)
 
     # Step 3 check for number of commits
-    for user in list(triage_list.keys()):
-        num_commits = get_num_commits(gh, user, one_year_ago)
+    with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
         # Override the total number of commits to not double count commits and
         # authored PRs.
-        triage_list[user].set_authored(num_commits)
+        executor.map(lambda user: triage_list[user].set_authored(get_num_commits(gh, user, one_year_ago)),list(triage_list.keys()))
 
     print("After Commits:", len(triage_list), "triagers")
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/181204


More information about the llvm-commits mailing list