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

Invalid containers can break dict(client) call #299

Open
klauer opened this issue Feb 17, 2023 · 0 comments
Open

Invalid containers can break dict(client) call #299

klauer opened this issue Feb 17, 2023 · 0 comments

Comments

@klauer
Copy link
Contributor

klauer commented Feb 17, 2023

Current Behavior

Calling dict(client) when an invalid container is in the database raises an exception (and, of course, stops it from returning even a partial dictionary).

$ 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

Your Environment

pcds-5.6.0
whatrecord 0.4.2
happi 2.0.0

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

1 participant