Skip to content

I09-1 switch to config_server for hard undulator lut#1798

Open
Villtord wants to merge 39 commits intomainfrom
i09-1-add_lut_from_config_server
Open

I09-1 switch to config_server for hard undulator lut#1798
Villtord wants to merge 39 commits intomainfrom
i09-1-add_lut_from_config_server

Conversation

@Villtord
Copy link
Copy Markdown
Contributor

@Villtord Villtord commented Dec 18, 2025

This change utilises existing functionality of the config server to read undulator parameters from.
Fixed #1919

Instructions to reviewer on how to test:

  1. Confirm dodal connect i09-1 works.
  2. Confirm tests pass.

Checks for reviewer

  • Would the PR title make sense to a scientist on a set of release notes
  • If a new device has been added does it follow the standards
  • If changing the API for a pre-existing device, ensure that any beamlines using this device have updated their Bluesky plans accordingly
  • Have the connection tests for the relevant beamline(s) been run via dodal connect ${BEAMLINE}

@Villtord Villtord self-assigned this Dec 18, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.11%. Comparing base (196af4f) to head (62e4828).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1798   +/-   ##
=======================================
  Coverage   99.11%   99.11%           
=======================================
  Files         318      318           
  Lines       12354    12370   +16     
=======================================
+ Hits        12245    12261   +16     
  Misses        109      109           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Villtord Villtord marked this pull request as ready for review January 20, 2026 11:24
@Villtord Villtord requested a review from a team as a code owner January 20, 2026 11:24
@oliwenmandiamond
Copy link
Copy Markdown
Contributor

Your i09 devices will be need to be moved to dodal.devices.beamlines.i09_1_shared #1866

@Villtord Villtord marked this pull request as draft February 6, 2026 11:13
@Villtord Villtord marked this pull request as ready for review February 11, 2026 14:13
@Villtord
Copy link
Copy Markdown
Contributor Author

Anyone willing to review?

@@ -51,7 +65,8 @@ def iidenergy(
return HardInsertionDeviceEnergy(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown
Contributor

@jacob720 jacob720 Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 client

But we still have to call set_config_client(client) in case the config client needs to be obtained inside a plan.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you direct me to where you use it in plans?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use lookuptable from config server to read hard-x-ray undulator parameters on i09

3 participants