Skip to content

Commit

Permalink
Merge pull request #846 from spc-group/lazy_listdevice
Browse files Browse the repository at this point in the history
Added try...except for unconnected components when using apstools.uti…

@canismarko Thanks for the contribution!
  • Loading branch information
prjemian authored May 23, 2023
2 parents a093770 + 1882c77 commit 351cdb3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions apstools/utils/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ def _all_signals(base):
items = []
if hasattr(base, "component_names"):
for k in base.component_names:
obj = getattr(base, k)
# Check for lazy components that may not be connected
try:
obj = getattr(base, k)
except TimeoutError:
logger.warning(f"Could not list component: {base.name}.{k}")
continue
if isinstance(obj, (Device, Signal)):
items += _all_signals(obj)
return items
Expand Down Expand Up @@ -90,10 +95,11 @@ def listdevice(
show_ancient=True,
table_style=TableStyle.pyRestTable,
):
"""
Describe the signal information from device ``obj`` in a pandas DataFrame.
"""Describe the signal information from device ``obj`` in a pandas DataFrame.
Look through all subcomponents to find all the signals to be shown.
Look through all subcomponents to find all the signals to be
shown. Components that are disconnected will be skipped and a
warning logged.
PARAMETERS
Expand Down Expand Up @@ -141,6 +147,7 @@ def listdevice(
.. note:: ``pandas.DataFrame`` wll truncate long text
to at most 50 characters.
"""
scope = (scope or "full").lower()
signals = _all_signals(obj)
Expand Down

0 comments on commit 351cdb3

Please sign in to comment.