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

PV Condition Nodes | Store Value In Memory for Instanteous Return #12

Open
joshc-slac opened this issue Jul 10, 2024 · 10 comments
Open

Comments

@joshc-slac
Copy link
Collaborator

We can subclass condition nodes such that the boolean they are returning is stored in memory and we do not have to wait for a caget or other non zero return time process.

@ZLLentz has cool ideas about this with camonitor calls backs.

@ZLLentz
Copy link
Member

ZLLentz commented Jul 10, 2024

Overall summary of the idea:

  • BT consumer/executor process (server-side) reads the full tree and finds all the PVs to be checked
  • The process monitors each PV with a callback to cache the result (+ alarm info)
  • Check nodes get their values instantaneously from the cache rather than slowly via caget

@ZLLentz
Copy link
Member

ZLLentz commented Jul 10, 2024

Timing-wise, the new values would come in on a background thread via the implementation of whichever CA library wrapper we use and this could technically be at an indeterminate time.

@tangkong
Copy link
Contributor

We're not worried about stale values here? There's also definitely cases where we'll need to get fresh values (the case where one "do" routine has side effects on the system changing other system values)

@ZLLentz
Copy link
Member

ZLLentz commented Jul 11, 2024

We aren't more worried about stale values for a monitor architecture since caget will also fail the same way if values are stale. For disconnected values both methods will let us know but caget will take longer.

Edit: we probably are worried about stale values in general regardless on our getting approach

The point about fresh values is very important. Do we need to build in some sort of smart waiting into the action nodes so they don't return complete until the related values update?

@joshc-slac
Copy link
Collaborator Author

joshc-slac commented Jul 17, 2024

While we definitely need to be worried about stale values this would give us the ability to determine what stale means.

Logging can capture the in memory conception of the value and we should have a lever that allows us to have some control of how frequently these values are polled (or updated via event)

@tangkong
Copy link
Contributor

As long as we're sure that we're not just creating a place to store values only to reject them as stale most of the time or in the interest of safety.

This is starting to feel like premature optimization to me, how much of a lag do we expect from getting the value every time it's requested?

@ZLLentz
Copy link
Member

ZLLentz commented Jul 17, 2024

Lag is a fraction of a fraction of a second if the PV exists, otherwise it's whatever our timeout is set to.

@tangkong tangkong added this to the MVP (AutoMFX) milestone Jul 31, 2024
@joshc-slac
Copy link
Collaborator Author

To digest the above comments with slightly more perspective. Storing in memory may be less critical than having elegant code path should caget return None. This solution may then well be the same to "persisting" last cached value in memory. Potentially with timestamp...

@ZLLentz
Copy link
Member

ZLLentz commented Aug 5, 2024

I'd caution against persisting old values- caget returning None implies that something is wrong with the IOC and should be an error state of some kind.

@joshc-slac
Copy link
Collaborator Author

Might want to consider not making this an MVP deliverable. Will put on the table for next BEAMS tagup (maybe we want to make that weekly if theres bandwidth?)

@joshc-slac joshc-slac removed this from the MVP (AutoMFX) milestone Sep 4, 2024
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

No branches or pull requests

3 participants