-
Notifications
You must be signed in to change notification settings - Fork 2
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
Move XRC callbacks to common #652
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #652 +/- ##
==========================================
- Coverage 85.00% 84.98% -0.02%
==========================================
Files 98 96 -2
Lines 6548 6546 -2
==========================================
- Hits 5566 5563 -3
- Misses 982 983 +1
|
bde8d7a
to
972cb91
Compare
See #655 for sorting out the tests. Annoyingly, we might want to do this before merging, so we can be sure that this PR didn't break anything, but I don't want to hold up @noemifrisina 's work |
If all the important bits have been moved and sorting out the tests is all that's left to this one, I think it would be worth it to sort out the tests before merging this. While that might take awhile, as you said at least we'd be reasonably sure things are still working after this PR. For my work, I can just make a new branch off this one in the meantime and make a start |
Cool, as long as it's not holding you up |
|
||
if TYPE_CHECKING: | ||
from event_model.documents import Event, EventDescriptor, RunStart | ||
|
||
T = TypeVar("T", bound="ThreeDGridScan") | ||
|
||
|
||
class GridscanNexusFileCallback(PlanReactiveCallback): |
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.
Is there a particular reason why we're moving this particular nexus callback and not the rotation one too? Would it be worth making a nore general one from which both this and the rotation one in hyperion - and any other ones we need in the future - can inherit?
This would be a separate PR in any case, only trying to understand the what's going on...
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.
Yeah, there's no reason other than trying to not do everything at once. For now, I only need the bits in XRC, so I've only moved the parts needed for this
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.
Thanks. Sounds good to me, maybe add an issue if it doesn't exist already - or a comment about this on an existing one?
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.
It should be possible for the nexus callbacks to be much more generic. I think we could even get away with one for all usecases see #364
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.
Yeah, as long as no one is waiting for this PR, I can include that here
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 think that's going to be quite a big refactor, I would do it in a new PR
@@ -21,6 +28,7 @@ | |||
HardwareConstants, | |||
) | |||
from mx_bluesky.common.parameters.robot_load import RobotLoadAndEnergyChange | |||
from mx_bluesky.hyperion.parameters.constants import CONST |
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.
Nit: maybe import CONST as hyperion_const or something?
On a first read this threw me a bit because I was assuming CONST
would be common and not hyperion specific...
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.
Ah, good catch, I shouldn't be importing anything from Hyperion
to mx_bluesky/common
. We're meant to have linting rules which catches this, I'll check why it didn't work
On a first go through, looks okay, thank you. Will wait to finish review and approve till you're done with the tests. I'd say the fact that they pass right now is a good start though :) |
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.
Couple of comments between meetings, not a full review
class HyperionGridCommon(GridCommon, WithHyperionFeatures): | ||
# This class only exists so that we can properly select enable_dev_shm. Remove in | ||
# https://github.com/DiamondLightSource/hyperion/issues/1395""" | ||
class HyperionThreeDGridScan( |
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.
Should: ThreeDGridScan
already inherits from:
GridCommon,
SpecifiedGrid,
SplitScan,
WithOptionalEnergyChange,
So we can drop the others here
) | ||
parameters = HyperionThreeDGridScan.model_validate_json(hyperion_params) | ||
parameters = self.param_type.model_validate_json(mx_bluesky_parameters) |
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.
Could: Can we just always use do ThreeDGridScan.model_validate_json
here? We don't need all the additional stuff from Hyperion anyway? Maybe we can get away with an even broader base class e.g. in ispyb_callback
we just convert to a GridCommon
. Basically the more broader the baseclass the more reusable this callback should be
Fixes #214 and #215
Moves lots of the
external_interaction
code into common. Some main bits:ThreeDGridScan
whichHyperionThreeDGridScan
now inheritscommon
mx_bluesky
commonThreeDGridScan
any any children of this typeProbably difficult to review, sorry