[llvm] [Github] Add ability to filter jobs in job counting script (PR #82136)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 17 15:11:20 PST 2024
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/82136
This patch adds a new flag pair, --filter-gha-runners, and --no-filter-gha-runners, that filters out all non-Github hosted runners so that we can actual counts of the Github runners, where we are actually limited.
>From ec5aef696f2bd13c4dbd4cd900b884ce25b91067 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Sat, 17 Feb 2024 23:10:13 +0000
Subject: [PATCH] [Github] Add ability to filter jobs in job counting script
This patch adds a new flag pair, --filter-gha-runners, and
--no-filter-gha-runners, that filters out all non-Github hosted runners
so that we can actual counts of the Github runners, where we are
actually limited.
---
llvm/utils/count_running_jobs.py | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/llvm/utils/count_running_jobs.py b/llvm/utils/count_running_jobs.py
index a53bc02f7b0ae1..bf51de75347701 100644
--- a/llvm/utils/count_running_jobs.py
+++ b/llvm/utils/count_running_jobs.py
@@ -16,7 +16,7 @@
import github
-def main(token):
+def main(token, filter_gha_runners):
workflows = (
github.Github(args.token)
.get_repo("llvm/llvm-project")
@@ -28,6 +28,8 @@ def main(token):
for workflow in workflows:
for job in workflow.jobs():
if job.status == "in_progress":
+ if filter_gha_runners and job.runner_group_name != "GitHub Actions":
+ continue
print(f"{workflow.name}/{job.name}")
in_progress_jobs += 1
@@ -45,5 +47,18 @@ def main(token):
default=None,
nargs="?",
)
+ parser.add_argument(
+ "--filter-gha-runners",
+ help="Only consider jobs running on hosted Github actions runners",
+ action="store_true",
+ )
+ parser.add_argument(
+ "--no-filter-gha-runners",
+ dest="filter_gha_runners",
+ action="store_false",
+ help="Consider all running jobs",
+ )
+ parser.set_defaults(filter_gha_runners=True)
+
args = parser.parse_args()
- main(args.token)
+ main(args.token, args.filter_gha_runners)
More information about the llvm-commits
mailing list