FIX: reject invalid inputs up-front to avoid PUT timeouts - #40
Conversation
8bee898 to
b41050c
Compare
|
The put-completion was important to us to allow scans to not have hard-coded sleep statements between points. Without this signal we're left guessing at how long a step will take. For simulations that take varying amounts of time, this helps us be more efficient (and not have scans with single long steps force our step-waits to be long across the board) I might argue that the current behavior is correct. EPICS IOCs are terribly inconsistent in their behavior, but it's not uncommon for records to reject puts while processing is ongoing. We could have an additional PV similar to the
Doesn't a model need to finish simulating before any updates to PVs can be meaningful? Or do you mean that other clients attempting to read from the IOC cannot |
Makes sense. My original idea for gating involved monitoring output variables, which would only be posted with a new value after the simulation completes. That obviously has some caveats. I'm going to add a generic status PV to indicate model state.
In terms of rejecting puts while the model is simulating, I tend to agree. The issue I'm seeing though is all
Since updates are queued along with their I guess there are a couple of behavioral things we need to think about:
Should we setup a meeting this afternoon to hash this out? |
We do not need monotonic time here, and we are generally dealing with UNIX time everywhere else (including in p4p and pcaspy)
Two modes for PV ack'ing: * immediate: Ack the pvput/caput request as soon as it's been inserted into the update queue. * complete: Ack the pvput/caput request after the model is done simulating. Requires timeout changes on the client side for long-simulating models. Also adds a model state PV that gets updated with the model's current state.
b41050c to
540a818
Compare
|
There are intermittent test failures due to the |
tangkong
left a comment
There was a problem hiding this comment.
This seems reasonable. It's backwards compatible (so I'm happy). I mostly have questions and suggestions that we could look at later.
In IMMEDIATE mode, it seems like puts are queued up so that as soon as the first sim is complete the next will fire? This seems like it could lead to some confusing behavior where puts get automated and the model just runs sim after sim.
I think my preferred behavior would be to ignore puts while the sim is running, but perhaps that's not what the people wanted
deac3f7 to
da12775
Compare
da12775 to
f01711f
Compare
tangkong
left a comment
There was a problem hiding this comment.
Looks good to me! Thanks for accommodating my insistence on put-completion 😆
| Complete = "complete" | ||
|
|
||
|
|
||
| class VariableMode(str, Enum): |
There was a problem hiding this comment.
oh I forgot to mention, I think StrEnum is available in our versions of python (3.11). But it's not an important adjustment
There was a problem hiding this comment.
Fixed. I pretty much just copied LUME base here

Models that take a while to simulate can delay the put
donecallbacks until they timeout.caputjust shows a stale value in its readback, andpvputdisplays "Put timeout".Even if we move the
donecallbacks to before theModel.setcall, updates can get stalled in the queue and timeout. For example, if you have a slow model andcaput/pvputwhile the model is simulating.I'm not sure that there's a good way to implement
donecallbacks that encompass exceptions thrown during model simulation. The best thing we can do is reject invalid values up front in the CA/PVA callbacks. Luckily PVA allows us to specify an error message, though CA doesn't (hence theLOG.warn).Curious if you have any better ideas or feedback on this change @tangkong. Do you guys need the caput-waits-for-model-simulation behavior?
Closes #39
Closes #43