Skip to content

Add docs for where to put dodal logic #1250

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

olliesilvester
Copy link
Collaborator

Fixes #617

Instructions to reviewer on how to test:

  1. run tox -e docs autobuild and read the docs added
  2. Furiously debate the wording

After writing this I noticed a very similar section in ophyd-async https://blueskyproject.io/ophyd-async/main/explanations/where-device-logic.html . This dodal page is more diamond specific, but I'm perhaps it's better to delete the overlap?

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}

@olliesilvester olliesilvester requested a review from a team as a code owner May 29, 2025 15:36
Copy link

codecov bot commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.06%. Comparing base (56091f0) to head (03d3bb3).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1250      +/-   ##
==========================================
+ Coverage   97.98%   98.06%   +0.07%     
==========================================
  Files         199      203       +4     
  Lines        7686     7788     +102     
==========================================
+ Hits         7531     7637     +106     
+ Misses        155      151       -4     

☔ 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.

@olliesilvester
Copy link
Collaborator Author

I think I should probably also include something about when composite devices. Perhaps: if a group of devices would only ever be used together, and never individually, then a composite device is suitable.

Copy link
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Furiously debate the wording

I will try and avoid this as much as possible, that being said...

We already have information like this at:

Can we either make sure it's linked or, ideally put it all on the one page and avoid repetition.

1. It only affects one device, is simple, won't change often, and/or is useful for scientists to be able to run outside of any DAQ framework. In this situation, it should go into EPICS. For example, zeroing a motor.

2. It only affects one device, is complicated, and may require frequent tweaking. This should go into dodal. For example, setting the undulator gap based on an energy input.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should: There is a missing category here. Where it is affects multiple devices but is not experiment specific. e.g. changing the energy for the DCM, whilst keeping the Undulator gap correct. We have done this in UndulatorDCM but could have used a plan. The reasoning for a device was:

  • It takes time and we have no way of running concurrent plans but we do for concurrent device sets
  • It's low level and experiment/beamline agnostic

I think there is debate to be had here though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this category is my number 4, maybe I wasn't clear on the "multiple devices" part though.

I was going to include that you could make a composite device in this case too, but I know there are still some differing opinions there. To me, my above comment

Perhaps: if a group of devices would only ever be used together, and never individually, then a composite device is suitable.

covers most cases, and I agree with you that not being able to write parallel plans is another good reason to use a device composite.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, I think put that in then. It's ok for docs to say "this is an option to think about in this case but it's very usecase dependant"

@olliesilvester
Copy link
Collaborator Author

I think linking to the ophyd async docs covers a lot of what I had written, but hopefully the new flowchart helps. There is still a bit of repetition in the how to guide for creating a device, but I don't think it's too bad - it goes into more detail

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.

Document guidance for deciding at which layer a piece of logic should go
2 participants