-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
utils.py with function to get repositories for given hpc (#119)
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |