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

[FB] Decision on controller API #4

Open
jacopoabramo opened this issue Dec 23, 2024 · 1 comment
Open

[FB] Decision on controller API #4

jacopoabramo opened this issue Dec 23, 2024 · 1 comment
Labels
feedback-requested I would like somebody else's opinion on this

Comments

@jacopoabramo
Copy link
Collaborator

I imagined that controllers can do 3 things in Redsun:

  1. render information (they simply collect documents from the run engine, shuffle/modify them a bit) and then send it to the UI;
  2. ship plans (construct message generators that can be customized via functools.partial and via the UI re-built whenever a parameter they have in their signature is changed);
  3. monitoring a workflow that is not bound to the overall acquisition;
    • a good example is having a separate channel for maintaining a stable lock on the current focus plane where a detector continously acquires data points (the detector being an area or point detector).

The first point is easily managed: the run engine provides a subscription systems via callbacks and each callback can filter on the type of received document. What the user can do is:

  • emit a psygnal to the engine handler to register a subscription;
  • when the callback is invoked, emit a signal connected to the virtual bus to be forwarded to the upper layers, or alternatively connect via another signal to a separate thread, perform a computation and then send it to the upper layers.

The second point is more challenging: what happens if an user wants to execute multiple plans from different controllers? Can these be dynamically built and executed? The run engine right now can only execute one plan at a time; it has the possibility to have nested plans and the documentation is quite extensive on the possibilities (see here for reference). But at the same time executing two plans concurrently doesn't seem to be supported (see this issue). I think that for a starting point, for safety reasons, the plans should be shipped and executed singularly. Since the controllers are anyway to be customized for specific purposes it's a good starting point.

The third point somewhat relates to the second. A starting approach would be to execute the plan in a separate thread which implements a similar mechanism of the run engine but with limited capabilities. This section of Bluesky's documentation gives some insights on how to build a custom engine, since the important part is keeping consistency with the message protocol functionalities.

ExEngine would be a solution (also to replace the original run engine and use it as a possible alternative), but at this time it implements a different approach which is not compatible with Bluesky's message protocol and event model. Since the project is still somewhat a work in progress it could be adapted to Bluesky somehow - if the authors would like to do so.

@jacopoabramo jacopoabramo added the feedback-requested I would like somebody else's opinion on this label Dec 23, 2024
@jacopoabramo jacopoabramo changed the title Decision on controller API [FB] Decision on controller API Dec 23, 2024
@jacopoabramo
Copy link
Collaborator Author

PR #9 changed a bit the controller API

  • the base controller is now a protocol instead of an abstract class;
  • changed the way the plans are registered in the device handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback-requested I would like somebody else's opinion on this
Projects
None yet
Development

No branches or pull requests

1 participant