From 18f9f6dcc808a77e108c779d666dfcec1f3e3997 Mon Sep 17 00:00:00 2001 From: Furqan Baig Date: Wed, 15 May 2024 14:30:27 -0500 Subject: [PATCH] utils.py with function to get repositories for given hpc --- tools/utils.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tools/utils.py diff --git a/tools/utils.py b/tools/utils.py new file mode 100644 index 00000000..65293295 --- /dev/null +++ b/tools/utils.py @@ -0,0 +1,21 @@ +import urllib.request, json + +CYBERGIS_COMPUTE_SERVER='https://cgjobsup.cigi.illinois.edu/v2/git' + +def get_model_repos_for_hpc(hpc_name:str) -> list[str]: + git_repos = [] + with urllib.request.urlopen(CYBERGIS_COMPUTE_SERVER) as url: + data = json.load(url) + print(len(data['git'])) + for model, value in data['git'].items(): + if hpc_name in value['supported_hpc']: + git_repos.append(value["repository"]) + pass + pass + pass + return git_repos + +if __name__ == '__main__': + repos = get_model_repos_for_hpc(hpc_name='anvil_community') + for r in repos: + print(r)