Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide proper error message when image is not found on singularity hub #103

Open
yarikoptic opened this issue Sep 16, 2019 · 1 comment
Assignees

Comments

@yarikoptic
Copy link
Member

ATM

$> datalad containers-add blah -u shub://ReproNim/containers:bids-validator--non-existent 
[ERROR  ] 'image' [containers_add.py:_resolve_img_url:42] (KeyError)
traceback/details:
$> datalad --dbg containers-add bids-validator -i images/bids/bids-validator--1.3.1.sing --update --call-fmt '{img_dspath}/scripts/singularity_cmd run {img} {cmd}' -u shub://ReproNim/containers:bids-validator--1.3.1 
Traceback (most recent call last):
  File "/usr/bin/datalad", line 8, in <module>
    main()
  File "/usr/lib/python3/dist-packages/datalad/cmdline/main.py", line 494, in main
    ret = cmdlineargs.func(cmdlineargs)
  File "/usr/lib/python3/dist-packages/datalad/interface/base.py", line 628, in call_from_parser
    ret = list(ret)
  File "/usr/lib/python3/dist-packages/datalad/interface/utils.py", line 435, in generator_func
    result_renderer, result_xfm, _result_filter, **_kwargs):
  File "/usr/lib/python3/dist-packages/datalad/interface/utils.py", line 529, in _process_results
    for res in results:
  File "/usr/lib/python3/dist-packages/datalad_container/containers_add.py", line 222, in __call__
    imgurl = _resolve_img_url(url)
  File "/usr/lib/python3/dist-packages/datalad_container/containers_add.py", line 42, in _resolve_img_url
    url = shub_info['image']
KeyError: 'image'

> /usr/lib/python3/dist-packages/datalad_container/containers_add.py(42)_resolve_img_url()
-> url = shub_info['image']
(Pdb) p shub_info
{'detail': 'Not found.'}

I think we might want to define a proper exception (ImageNotFoundError base class, and SingularityHubImageNotFoundError) to be raised in corresponding spot(s), and then caught/reported consistently across backends with an more informative error message error, e.g.
"Failed to resolve image url for shub://ReproNim/containers:bids-validator--non-existent . Response was: 'Not found'" or alike

@yarikoptic
Copy link
Member Author

another error message to expect (I added a print for the manifest there before the actual "logic" kicks in):

$> singularity pull shub://ReproNim/containers:bids-freesurfer--v6.0.1-5
{u'detail': u'Request was throttled. Expected available in 17837 seconds.'}
Traceback (most recent call last):
  File "/usr/lib/x86_64-linux-gnu/singularity/python/pull.py", line 74, in <module>
    main()
  File "/usr/lib/x86_64-linux-gnu/singularity/python/pull.py", line 66, in main
    layerfile=LAYERFILE)
  File "/usr/lib/x86_64-linux-gnu/singularity/python/shub/main.py", line 87, in PULL
    image_name = get_image_name(manifest)
  File "/usr/lib/x86_64-linux-gnu/singularity/python/shub/api.py", line 242, in get_image_name
    return get_default_name(manifest)
  File "/usr/lib/x86_64-linux-gnu/singularity/python/shub/api.py", line 262, in get_default_name
    version = manifest['branch']
KeyError: 'branch'

adswa pushed a commit to adswa/datalad-container that referenced this issue Nov 8, 2023
…s/actions/checkout-4

[gh-actions](deps): Bump actions/checkout from 3 to 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants