You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The traceback I see here complains that we can't do ophyd.Device things with str
traceback
Traceback (most recent call last):
File "/Users/roberttk/src/bluesky/bluesky/run_engine.py", line 1528, in _run
msg = self._plan_stack[-1].send(resp)
File "/Users/roberttk/src/bluesky/bluesky/plans.py", line 66, in count
_md = {'detectors': [det.name for det in detectors],
File "/Users/roberttk/src/bluesky/bluesky/plans.py", line 66, in <listcomp>
_md = {'detectors': [det.name for det in detectors],
AttributeError: 'str' object has no attribute 'name'
Looking further, bluesky_queueserver.prepare_plan returned a parsed plan that did not substitute the detector for its ophyd object
Perhaps when encountering a typing.Any hint, we treat the annotation the same way we do when it's missing and attempt to convert the argument to a device or plan?
Properly type hinting without the extra information in parameter_annotation_decorator seems tough. Is there something in the bluesky.protocols that could help us here?
Steps to Reproduce (for bugs)
see above
Context
I annotated all the bluesky plans and they stopped working in my queueserver tests
Your Environment
bluesky_queueserver 0.18, pydantic 2.1.1
The text was updated successfully, but these errors were encountered:
Perhaps I'm just not using the bluesky_queueserver utilities how they're supposed to be used, but I think this is a more basic issue with being able to use the native python type hints.
As I mentioned in bluesky/bluesky#1600 (comment) , we could make the queue server replace type names from some limited fixed set (e.g. protocols.Readable, protocols.Movable etc.) by __DEVICE__. The main problems is to select right set of types so that they make sense if the Python code is checked with mypy or some other tool.
Expected Behavior
When using native python type hints with the standard
bluesky.plans
, plans should prepare successfullyCurrent Behavior
This behavior varies depending on the plan annotations.
This works (status quo):
In this case,
bluesky_queueserver.prepare_plan
replaces my detector as expected:This fails:
The traceback I see here complains that we can't do
ophyd.Device
things withstr
traceback
Looking further,
bluesky_queueserver.prepare_plan
returned a parsed plan that did not substitute the detector for its ophyd objectand this succeeds again:
Possible Solution
Perhaps when encountering a
typing.Any
hint, we treat the annotation the same way we do when it's missing and attempt to convert the argument to a device or plan?bluesky-queueserver/bluesky_queueserver/manager/profile_ops.py
Lines 954 to 956 in a6d9b48
Properly type hinting without the extra information in
parameter_annotation_decorator
seems tough. Is there something in thebluesky.protocols
that could help us here?Steps to Reproduce (for bugs)
see above
Context
I annotated all the bluesky plans and they stopped working in my queueserver tests
Your Environment
bluesky_queueserver 0.18, pydantic 2.1.1
The text was updated successfully, but these errors were encountered: