-
Notifications
You must be signed in to change notification settings - Fork 6
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
746 blueapi does not call connect on all devices in a dodal beamline #751
746 blueapi does not call connect on all devices in a dodal beamline #751
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #751 +/- ##
==========================================
+ Coverage 93.10% 93.20% +0.09%
==========================================
Files 36 37 +1
Lines 2030 2074 +44
==========================================
+ Hits 1890 1933 +43
- Misses 140 141 +1 ☔ View full report in Codecov by Sentry. |
src/blueapi/core/context.py
Outdated
def is_simulated_device(name, factory, **kwargs): | ||
device = devices.get(name, None) | ||
mock_flag = kwargs.get("mock", kwargs.get("fake_with_ophyd_sim", False)) | ||
return device is not None and ( | ||
isinstance(factory, DeviceInitializationController) | ||
and (factory._mock or mock_flag) # noqa: SLF001 | ||
and isinstance(device, OphydV1Device | OphydV2Device) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we're seeing here is a consequence of a discussion @DiamondJoseph and I had about DiamondLightSource/dodal#881.
The mock
parameter of the API of DeviceInitializationController
is meaningless unless connect_immediately=True
, it is just ignored otherwise and you have to go digging through the factory to find out if it was set.
You can argue that it should actually be called mock_if_connect_immediately
or similar.
This is confusing and makes this use case hard so it should be addressed. I can't think of a better way to do this at the moment so we will have to keep it but please make an issue on dodal explaining that you found this hard to implement with the DeviceInitializationController
API and a corresponding issue in blueapi to simplify this code when we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll mention this in a ticket in dodal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, thanks for bearing with
closes #746