-
Notifications
You must be signed in to change notification settings - Fork 10
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
Update MX beamlines to use new device factory - part 1 #975
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #975 +/- ##
==========================================
+ Coverage 97.48% 97.54% +0.06%
==========================================
Files 148 148
Lines 6238 6279 +41
==========================================
+ Hits 6081 6125 +44
+ Misses 157 154 -3 ☔ View full report in Codecov by Sentry. |
1e10ec6
to
8096af2
Compare
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.
Looks good, but I feel like we should put the part which fixes device_factory
for v1 devices into a separate PR.
Also, for this issue we might as well convert all of the devices in i04, i24 and i23 to use the new instantiation
src/dodal/beamlines/i03.py
Outdated
@device_factory() | ||
@skip_device(lambda: BL == "s03") |
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.
Depending on how mx-bluesky/hyperion is handling this:
@device_factory() | |
@skip_device(lambda: BL == "s03") | |
@device_factory(skip = BL == "s03") |
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.
or skip = (BL == "s03")
if it's any clearer what is meant
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.
At this point, I think we are likely going to remove all this s03
stuff soon as I think we have pretty much given up on the simulator.
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.
There is a separate issue to remove the s03 system tests and I have updated that to remove s03 completely
src/dodal/beamlines/i03.py
Outdated
@device_factory() | ||
@skip_device(lambda: BL == "s03") | ||
def flux(wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False) -> Flux: | ||
def flux(mock: bool = False) -> Flux: | ||
"""Get the i03 flux device, instantiate it if it hasn't already been. | ||
If this is called when already instantiated in i03, it will return the existing object. | ||
""" | ||
return device_instantiation( | ||
Flux, | ||
"flux", | ||
"-MO-FLUX-01:", | ||
wait_for_connection, | ||
fake_with_ophyd_sim, | ||
wait=False, | ||
fake=mock, |
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.
Seems to be mixing the two device factory types?
) -> Callable[[Callable[[], T]], DeviceInitializationController[T]]: | ||
def decorator(factory: Callable[[], T]) -> DeviceInitializationController[T]: |
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.
This has to be D, Ophyd-Async only device, the connection logic does not work for Ophyd devices.
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 have made modifications so that the device factory will now work with ophyd v1 devices.
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.
So you have, if you can't tell that I stopped looking when I reached this point ;)
I thought MX only had the Eiger left on ophyd v1?
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.
Plus a few other minor devices, s4_slits, etc. There is currently a GH ticket to move those across but the Eiger is the main thing, it will probably be a little while yet before that gets moved over to ophyd_async. I thought better to make a start on this.
Once they are moved over, we will be able to get rid of a whole bunch of code including the device_instantiation
stuff.
Fingers quicker than brain and eyes
…being created in the beamline
9c828ca
to
7ec1f74
Compare
Fixes
for I03, other beamlines to follow in separate PR on top of this one.
Also fixes the following issues:
diamond_filter
was not being instantiated because python generic device types were not recognised as valid device factories.device_factory
did not support usage with sync v1 ophyd devicesSee also mx-bluesky PR
Instructions to reviewer on how to test:
Checks for reviewer
dodal connect ${BEAMLINE}