bluesky / ophyd

hardware abstraction in Python with an emphasis on EPICS
https://blueskyproject.io/ophyd
BSD 3-Clause "New" or "Revised" License
51 stars 79 forks source link

ENH: Add a StableSubscriptionStatus #1155

Closed DominicOram closed 1 year ago

DominicOram commented 1 year ago

Fixes #1142.

Adds a stable subscription status that easily allows for checking that a component stays stable for some time. Also, adds docs and tests for it.

danielballan commented 1 year ago

I have only skimmed the code but I will offer high-level comments. We have wanted something like this for awhile, and I think this is a quite elegant way to do it.

I think it is accurate to describe this as a kind of client-side deadband.


[Continued after accidentally submitting the form early…]

I think one-off implementations of this exist at NSLS-II, and probably elsewhere, but I am not aware of a generic implementation. I think it is worth putting this in core.

A downside of client-side deadbands is that each client has to implement its own logic for deciding when the signal is "stable". A server side deadband solves the problem once and ensures that all clients have a consistent view on this determination. (In EPICS, this is ideally done by supporting WRITE_NOTIFY which communicates the done-ness of a specific operation, denoted by an id shared between the request and the response.)

The advantage of doing it client side:

Is it worth putting something to this effect in the docs? In summary, I would advice some caution in reaching for this feature (think: should I do this in the IOC?) but it comes up frequently enough that I absolutely agree this is worth having.

@ZLLentz @tangkong @klauer Have you ever developed something like this? Any thoughts?

danielballan commented 1 year ago

Note previous comment was extensively edited: I pressed submit early by accident.

DominicOram commented 1 year ago

Is it worth putting something to this effect in the docs? In summary, I would advice some caution in reaching for this feature (think: should I do this in the IOC?) but it comes up frequently enough that I absolutely agree this is worth having.

@ZLLentz @tangkong @klauer Have you ever developed something like this? Any thoughts?

Yes, I agree that it's cleaner to be server side but I think it's useful as you've said. I will add in some docs to this affect.

DominicOram commented 1 year ago

Docs updated, feel free to add additional comments.

tangkong commented 1 year ago

Have you ever developed something like this? Any thoughts?

We've not developed anything similar, to the best of our knowledge. Looks useful though! I don't have any thoughts to add, Dan covered the considerations that come to mind for me.

callumforrester commented 1 year ago

I think the docs build breaking may be legitimate, happy to approve once that's fixed

DominicOram commented 1 year ago

I think the docs build breaking may be legitimate, happy to approve once that's fixed

Docs now passing, are you happy to approve @callumforrester?