Skip to content
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

Beamline creation readme #323

Merged
merged 6 commits into from
Feb 13, 2024
Merged

Beamline creation readme #323

merged 6 commits into from
Feb 13, 2024

Conversation

DiamondJoseph
Copy link
Contributor

@DiamondJoseph DiamondJoseph commented Feb 9, 2024

Addresses #321 (hopefully in time to assist creation of i20-1 beamline, help get i22 merged)

Instructions to reviewer on how to test:

  1. Follow through the readme whilst creating a new beamline
  2. Confirm that the created beamline passes all tests, creates sensible devices

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

Copy link

codecov bot commented Feb 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7c73805) 89.97% compared to head (a258c40) 92.07%.

❗ Current head a258c40 differs from pull request most recent head 217cc52. Consider uploading reports for the commit 217cc52 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #323      +/-   ##
==========================================
+ Coverage   89.97%   92.07%   +2.10%     
==========================================
  Files          83       83              
  Lines        3171     3181      +10     
==========================================
+ Hits         2853     2929      +76     
+ Misses        318      252      -66     

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

@DiamondJoseph DiamondJoseph force-pushed the beamline-creation-readme branch 2 times, most recently from 16f92f2 to 35c80b7 Compare February 12, 2024 16:19
@DiamondJoseph
Copy link
Contributor Author

This change does enforce that Only device factory functions are defined in the beamlines package, and also enforces that beamlines either utilise device_instantiation or some other form of ensuring their methods return a singleton.

Test coverage of new beamlines is already above the required patchset percentage just by inclusion in test_device_instantiation, which should reduce the barrier to entry of getting new beamlines added.

@DiamondJoseph DiamondJoseph marked this pull request as ready for review February 12, 2024 16:41

def test_device_creation():
devices = make_all_devices(i24, fake_with_ophyd_sim=True)
@patch.object(dodal.utils, "get_beamline_name", return_value="i24")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I prefer the solution in #330 (review) - I know it's just a test, but reloading modules and deleting from sys feels extra messy to me - and it's not really necessary - all that's needed is to set the beamline_utils.BL and clear the devices like I did here 05ab615

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that 330 is merged I'm happy to just rebase on top of main again and discard this. Any thoughts on the rest of the changes?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I think this is great! it'll be very helpful I'm sure. It looks detailed enough for most developers to me, hopefully that's right. But I think you'd get better feedback from someone who didn't write the thing in the first place, haha

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the i24 test changes from the tree

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But now i24 is failing again

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm looking into it, I think it's not relevant for this PR, you can merge it anyway

Copy link
Collaborator

Choose a reason for hiding this comment

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

- Prevents issue with RunEngine event_loop not being available
- Reduces duplication
- Expandable to new beamlines
Copy link
Collaborator

@dperl-dls dperl-dls left a comment

Choose a reason for hiding this comment

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

Thanks for this! I see nothing objectionable here so I think we can improve it later if we can get some feedback from people who look at it with fresh eyes

@DiamondJoseph DiamondJoseph merged commit 4a8ab3b into main Feb 13, 2024
11 of 14 checks passed
@DiamondJoseph DiamondJoseph deleted the beamline-creation-readme branch February 13, 2024 12:49
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.

3 participants