pcdshub / whatrecord

EPICS IOC meta information tool
https://pcdshub.github.io/whatrecord/
Other
8 stars 6 forks source link

happi plugin: invalid container specification can break plugin #150

Closed klauer closed 1 year ago

klauer commented 1 year ago

Current Behavior

$ python -m whatrecord.plugins.happi
Traceback (most recent call last):
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/happi/client.py", line 305, in _get_item_from_document
    item = self.create_item(doc["type"], **doc)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/happi/client.py", line 239, in create_item
    raise TypeError(
TypeError: The container class 'pcdsdevices.happi.containers.Leviton' is not in the registry

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/happi/client.py", line 491, in __getitem__
    item = self._get_item_from_document(self.backend.get_by_id(key))
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/happi/client.py", line 307, in _get_item_from_document
    raise EntryError(
happi.errors.EntryError: The information relating to the container class has been modified to the point where the object can not be initialized, please load the corresponding document

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/whatrecord/plugins/happi.py", line 400, in <module>
    _cli_main()
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/whatrecord/plugins/happi.py", line 393, in _cli_main
    results = main(**vars(args))
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/whatrecord/plugins/util.py", line 35, in wrapper
    results = func(*args, **kwargs)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/whatrecord/plugins/happi.py", line 352, in main
    for item in dict(client).values()
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/happi/client.py", line 493, in __getitem__
    raise KeyError(key) from ex
KeyError: 'cxi_leviton_r51_h'

Possible Solution

Be more lenient about bad containers, perhaps provide information on failures even

Context

happi-to-confluence Upstream issue https://github.com/pcdshub/happi/issues/299

Your Environment

pcds-5.6.0 whatrecord 0.4.2