diff mbox series

[yocto-autobuilder-helper] scripts/list-ab-workers

Message ID 20250313131656.3404378-1-ross.burton@arm.com
State New
Headers show
Series [yocto-autobuilder-helper] scripts/list-ab-workers | expand

Commit Message

Ross Burton March 13, 2025, 1:16 p.m. UTC
This is a a little script I have that should be somewhere public. It
simply lists all of the connected workers, but is very useful when used
in conjunction with parallel-ssh to run commands on every worker at once.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/list-ab-workers.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 scripts/list-ab-workers.py
diff mbox series

Patch

diff --git a/scripts/list-ab-workers.py b/scripts/list-ab-workers.py
new file mode 100644
index 00000000..26f03982
--- /dev/null
+++ b/scripts/list-ab-workers.py
@@ -0,0 +1,20 @@ 
+#! /usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# This script will list all of the connected workers on the autobuilder.
+
+import requests
+
+buildbot_api = "https://autobuilder.yoctoproject.org/valkyrie/api/v2/"
+
+http = requests.Session()
+
+def buildbot(method, **args):
+    return http.get(buildbot_api + method, params=args).json()
+
+for worker in buildbot(f"workers")["workers"]:
+    # Skip workers that are not connected to any controllers
+    if not worker["connected_to"]:
+        continue
+    print(f"{worker['name']}.yocto.io")