-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add prepare command to RunEngine and bundler, as well as protocol #1639
Conversation
I've got some questions after trying to implement this... I looked at existing protocols like kickoff/complete and used those as templates to try doing prepare.
I've also noticed a few things I've noticed in the codebase which I think, either I don't understand fully, or perhaps could be 'cleaned up':
I realise this is probably a massive tangent, but this is one of the few times I've touched anything in the bluesky repo so I have lots of questions. Perhaps I should make some separate issues that can be addressed as part of a bluesky hackathon or something similar, but to me as someone who doesn't often touch the codebase there seems to be scope for clean up tasks of the repo, which also includes formatting it properly maybe with tools like ruff. I'd be interested in people's thoughts on this. Edit: perhaps we should have a 'devsug' label for some github issues, to indicate a developer suggestion for this type of thing? |
One idea, as I recall it, was that methods that return |
@runtime_checkable
class Preparable(Protocol):
@abstractmethod
def prepare(self, value) -> Status:
"""Prepare a device for fly scanning, i.e. configure the correct triggers."""
... Could you say more about how the returned |
After the conversation with @prjemian and @danielballan we settled on this scheme for flyers:
In this case, we are moving motors which could take a reasonable amount of time The same could be said for a detector:
We also thought that this could also be useful for step scanning the same detectors:
|
Thank you @coretl. Could you also comment on how |
Question for @tacaswell
Question for @tacaswell
This is for historic reasons, but is actually defendable:
I would argue that
That seems like a good target to clean up
Question for @tacaswell
Question for @tacaswell
This is because the
This will be done, but not yet. We want to finish the copier project internally first and check that is the right tool for applying to the rest of the repos. |
|
just realised I haven't added a test to this; I'll have a look at doing this tomorrow morning so this can be merged relatively soonish |
I've now written a test for this, for the flyscan case. Since the call yesterday I've removed Personally I think it makes sense to enforce that prepare should be called inside of a run. But I found this interesting.. I'm going to create a GH issue about |
A But |
I'll leave it to @coretl to merge if ready. |
See discussion in #1644
I can see arguments both ways, but lean to leaving it allowed outside runs as it is about moving stuff around (e.g. we don't require a run to be open to stage) not about collecting and collating data. I suspect in practice it will mostly be used inside of an
See discussion in #1642
See discussion in #1646
I think they are mostly relying on closures of values from the local scope to work. Could probably be factored into a factory function or |
Also looks good to me, but if Dan is deferring to @coretl to merge so will I. |
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.
Please could we include this in hardware.rst
, maybe somewhere around
bluesky/docs/source/hardware.rst
Line 258 in 9b0d729
resolves #1637