Created
November 2, 2019 17:12
-
-
Save djmitche/08c06c8a6a310a28f6c040ace2dbca97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import sys | |
import os | |
import urllib.request | |
def main(): | |
rootUrl = os.environ["TASKCLUSTER_ROOT_URL"] | |
workerPoolId = sys.argv[1] | |
apiUrl = rootUrl + "/api/worker-manager/v1/workers/" + workerPoolId | |
continuationToken = None | |
while True: | |
url = apiUrl + "?limit=100" | |
if continuationToken: | |
url += "&continuationToken={}".format(continuationToken) | |
with urllib.request.urlopen(url) as res: | |
data = json.loads(res.read()) | |
for worker in data["workers"]: | |
print(json.dumps(worker, sort_keys=True, indent=4)) | |
if "continuationToken" in data: | |
continuationToken = data["continuationToken"] | |
else: | |
break | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment