Skip to content

Commit

Permalink
Merge branch 'feature/repo_updates_via_api' into feature/docker-jupyt…
Browse files Browse the repository at this point in the history
…erhub-pg
  • Loading branch information
pgleeson committed Jan 23, 2025
2 parents a5366a3 + 1dafe78 commit af807b0
Show file tree
Hide file tree
Showing 23 changed files with 16,430 additions and 3,126 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-jupyterlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Docker Image Build Jupyterlab

on:
push:
branches: [ master, dev*, feature/docker*, jupyterhub-update ]
branches: [ master, dev*, feature/docker*, feature/repo*, jupyterhub-update ]
pull_request:
branches: [ master, dev*, feature/docker*, jupyterhub-update ]
branches: [ master, dev*, feature/docker*, feature/repo*, jupyterhub-update ]

jobs:

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-netpyne.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Docker Image Build NetPyNE-UI

on:
push:
branches: [ master, dev*, feature/docker*, jupyterhub-update ]
branches: [ master, dev*, feature/docker*, feature/repo*, jupyterhub-update ]
pull_request:
branches: [ master, dev*, feature/docker*, jupyterhub-update ]
branches: [ master, dev*, feature/docker*, feature/repo*, jupyterhub-update ]

jobs:

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-nwbe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Docker Image Build NWB Explorer

on:
push:
branches: [ master, dev*, feature/docker*, jupyterhub-update ]
branches: [ master, dev*, feature/docker*, feature/repo*, jupyterhub-update ]
pull_request:
branches: [ master, dev*, feature/docker*, jupyterhub-update ]
branches: [ master, dev*, feature/docker*, feature/repo*, jupyterhub-update ]

jobs:

Expand Down
1 change: 1 addition & 0 deletions applications/jupyterlab/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ ENV PATH=$PATH:$NEST_HOME/bin

USER jovyan
#### Install Python packages
RUN pip install backports.tarfile>=1.2 # temp fix for error: ImportError: cannot import name 'tarfile' from 'backports'
RUN pip install -r requirements.txt --upgrade --no-cache-dir

# Compile NEURON mod files for PyNN
Expand Down
107 changes: 107 additions & 0 deletions libraries/client/biomodels_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
"""
Script to get Biomodels project info
"""

import json
import pprint
from loadbiomodels import get_model_identifiers, get_model_info

verbose = True #
verbose = False

info_all = {}


if __name__ == "__main__":
min_index = 0
max_index = 20
index = 0

from loadbiomodels import get_model_identifiers

model_ids = get_model_identifiers()["models"]

selection = model_ids[min_index:max_index]

for model_id in selection:
print(
"\n-------- Model (%i/%i, order %i): %s:\n"
% (index, len(selection), index + min_index, model_id)
)

model_link = f"[{model_id}](https://www.ebi.ac.uk/biomodels/{model_id})"
info = get_model_info(model_id)
model_name = info["name"]
print(f" {model_id}: \n {pprint.pformat(info['name'])}--")

info_all[model_id] = info
"""
son.loads(get_page('https://modeldb.science/api/v1/models/%s'%model))
print(' %s'%info[model]['name'])
if 'gitrepo' in info[model] and info[model]['gitrepo']:
with_gitrepo+=1
print(' gitrepo: %s'%info[model]['gitrepo'])
else:
print(' gitrepo: %s'%False)
expected_forks = 0
possible_mdb_repo = 'ModelDBRepository/%s'%(info[model]['id'])
try:
mdb_repo = gh.get_repo(possible_mdb_repo)
repo_to_use = mdb_repo
print(' Exists at: %s (def branch: %s; forks: %i)'%(mdb_repo.html_url, mdb_repo.default_branch, mdb_repo.forks))
possible_osbgh_repo = 'OpenSourceBrain/%s'%(info[model]['id'])
try:
osb_repo = gh.get_repo(possible_osbgh_repo)
msg = ' Exists at: %s (def branch: %s; forks: %i), order %i'%(osb_repo.html_url, osb_repo.default_branch, osb_repo.forks, index+min_index)
on_osbv2.append(msg)
print(msg)
repo_to_use = osb_repo
expected_forks+=1
info[model]['osbv2_gh_repo'] = repo_to_use.html_url
info[model]['osbv2_gh_branch'] = repo_to_use.default_branch
except:
print(' Missing fork: %s, forking now: %s'%(possible_osbgh_repo, fork_if_missing))
if fork_if_missing:
print(' Forking to: %s...'%possible_osbgh_repo)
org = gh.get_organization('OpenSourceBrain')
org.create_fork(mdb_repo,default_branch_only=False)
msg = ' Forked to: %s...'%possible_osbgh_repo
print(msg)
forked_now.append(msg)
else:
msg = ' Yet to be forked: %i, order %i; %s'%(info[model]['id'], index+min_index,info[model]['name'])
print(msg)
to_be_forked.append(msg)
if (not mdb_repo.forks==expected_forks) and (not (info[model]['id'] in known_to_have_other_forks)):
msg = ' Unexpected forks for %i (%s != %s)...'%(info[model]['id'], mdb_repo.forks,expected_forks)
print(msg)
many_forks.append(msg)
except:
msg = ' Problem locating repo for: %i (%i/%i) %s'%(info[model]['id'],index, len(selection), info[model]['name'])
print(msg)
errors.append(msg)"""

index += 1

if verbose:
infop = pprint.pprint(info_all, compact=True)

print("\nThere were %i models checked\n" % (len(info)))

filename = "cached_info/biomodels.json"

strj = json.dumps(info_all, indent=" ", sort_keys=True)
with open(filename, "w") as fp:
fp.write(strj)


print("Data on Biomodels (%i models) written to %s" % (len(info), filename))
Loading

0 comments on commit af807b0

Please sign in to comment.