recast-hep / recast-atlas

CLI for ATLAS RECAST contributors
https://recast.docs.cern.ch/
Apache License 2.0
5 stars 5 forks source link

`recast backends ls --check` should check only the installed backends #75

Closed matthewfeickert closed 2 years ago

matthewfeickert commented 2 years ago

If recast-atlas is installed in a clean venv, recast backends ls --check will fails as it checks for all backends and not just the installed backends.

$ docker run --rm -it python:3.8 /bin/bash
root@232d8cb7cdcf:/# python -m venv venv && . venv/bin/activate
(venv) root@232d8cb7cdcf:/# python -m pip --quiet install --upgrade pip "setuptools<58.0.0" wheel six
(venv) root@232d8cb7cdcf:/# python -m pip install recast-atlas
(venv) root@232d8cb7cdcf:/# pip freeze | grep recast-atlas
recast-atlas==0.1.8
(venv) root@232d8cb7cdcf:/# recast backends ls --check
NAME                DESCRIPTION                                                 STATUS    
Traceback (most recent call last):
  File "/venv/bin/recast", line 8, in <module>
    sys.exit(recastatlas())
  File "/venv/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/venv/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/venv/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/venv/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/venv/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/venv/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/venv/lib/python3.8/site-packages/recastatlas/subcommands/backends.py", line 18, in ls
    status = "OK" if check_backend(k) else "NOT OK"
  File "/venv/lib/python3.8/site-packages/recastatlas/backends/__init__.py", line 90, in check_backend
    return BACKENDS[backend].check_backend()
KeyError: 'local

This might be the indented behavior to motivate all backends being installed, but it doesn't seem helpful for diagnostics.

Thoughts @lukasheinrich?