Initial commit

This commit is contained in:
augustin64 2024-06-04 16:56:10 +02:00
commit 8c7548b7c7
2 changed files with 53 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
data
available.md

51
main.py Normal file
View File

@ -0,0 +1,51 @@
import requests
import json
import math
import sys
import os
def search_site(SITE):
os.makedirs(f"data/{SITE}", exist_ok=True)
filename = f"data/{SITE}/nodes.json"
if not os.path.exists(filename):
with open(filename, "wb") as f:
r = requests.get(f"https://public-api.grid5000.fr/stable/sites/{SITE}/clusters")
assert r.status_code == 200
f.write(r.content)
with open(filename, "r") as f:
data = json.load(f)
nodes = data["items"]
# assert input(f"{len(nodes)} nodes found. Confirm ? [y/N] ") in ["Y", "y"]
for node in nodes:
uid = node["uid"]
filename = f"data/{SITE}/node-{uid}.json"
if not os.path.exists(filename):
with open(filename, "wb") as f:
r = requests.get(f"https://public-api.grid5000.fr/stable/sites/{SITE}/clusters/{uid}/nodes.json")
assert r.status_code == 200
f.write(r.content)
with open(filename, "r") as f:
data = json.load(f)
item = data["items"][0]
nb_procs = item["architecture"]["nb_procs"]
nb_cores = item["architecture"]["nb_cores"]
platform_type = item["architecture"]["platform_type"]
proc_vendor = item["processor"]["vendor"]
microarch = item["processor"]["microarchitecture"]
if nb_procs == 2 and math.log2(nb_cores).is_integer() and platform_type == "x86_64" and proc_vendor.lower() == "intel":
print(f"{SITE}/{uid} (x{len(data['items'])}) : {nb_procs} procs, {nb_cores} cores (queues : {node['queues']}) : {microarch}")
if len(sys.argv) > 1:
for site in sys.argv[1:]:
search_site(site)
else:
search_site("rennes")