Repository navigation
I09-1 switch to config_server for hard undulator lut - #1798
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1798 +/- ##
=======================================
Coverage 99.12% 99.12%
=======================================
Files 319 319
Lines 12388 12404 +16
=======================================
+ Hits 12279 12295 +16
Misses 109 109 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Your i09 devices will be need to be moved to |
|
Anyone willing to review? |
| @@ -51,7 +65,8 @@ def iidenergy( | |||
| return HardInsertionDeviceEnergy( | |||
There was a problem hiding this comment.
I personally really dislike making config client global scope. However, this makes no sense as you have made it global, yet are still injecting it as a dependency for the device as configuration. Either use it globally, or use injection. I wouldn't mix the too.
However, looking at this further I can see several other beamlines have also opted for a similar pattern so I will raise as a separate issue
There was a problem hiding this comment.
@rtuck99 and I have discussed this, and there doesn't seem to be a great way of solving the problem that the client may be needed in plans as well as devices. In devices, the client can be injected but this doesn't work for plans. Welcome to any ideas to tidy this up
There was a problem hiding this comment.
For i03, I've created a device fixture so the device manager can inject the client into devices where needed:
@devices.fixture
@cache
def config_client() -> ConfigClient:
client = ConfigClient(I03_CONFIG_SERVER_ENDPOINT)
set_config_client(client)
return clientBut we still have to call set_config_client(client) in case the config client needs to be obtained inside a plan.
There was a problem hiding this comment.
Could you direct me to where you use it in plans?
There was a problem hiding this comment.
If you need access to it inside of plans, you can either make it an attribute of a device and then access that attribute of the device in the plan. Or you could wrap ConfigClient inside its own device and then easily inject it into any plan you need?
There was a problem hiding this comment.
https://github.com/DiamondLightSource/mx-bluesky/blob/62c0c9ae5d4eef36c2d60ea8d1800dece8cbe84b/src/mx_bluesky/hyperion/utils/context.py#L20
Here's one example. Also for beamline parameters which aren't necessarily linked to a device
Or you could wrap ConfigClient inside its own device and then easily inject it into any plan you need?
That's true, it feels a bit weird to make something a device just so we have access to it inside plans though. Would be nice if there was a different way.
There was a problem hiding this comment.
I agree maybe the name "Device" is slightly misleading, but it does utilise all the existing infrastructure and is much cleaner.
Something that might flow a little better is to get the DeviceManager in dodal and in turn Blueapi to support allowing objects to only implement the native HasName Bluesky protocol so it is clear it is not a device but is still findable and therefore injectable into plans. Would give much more flexibility for any other future use cases for other objects we need accessible in plans via BlueAPI which are not devices.
This change utilises existing functionality of the config server to read undulator parameters from.
Fixed #1919
Instructions to reviewer on how to test:
Checks for reviewer
dodal connect ${BEAMLINE}