951 activate callbacks based on plan#962
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #962 +/- ##
==========================================
+ Coverage 93.48% 93.53% +0.05%
==========================================
Files 54 55 +1
Lines 2623 2660 +37
==========================================
+ Hits 2452 2488 +36
- Misses 171 172 +1 ☔ View full report in Codecov by Sentry. |
| from event_model.documents.event import Event | ||
|
|
||
| if TYPE_CHECKING: | ||
| from event_model.documents.event import Event |
There was a problem hiding this comment.
This is imported twice
| self.activity_uid = 0 | ||
| return self.activity_gated_stop(doc) if do_stop else doc | ||
|
|
||
| def activity_gated_start(self, doc: RunStart): |
There was a problem hiding this comment.
Do we want to enforce implementation of these functions for subclasses of PlanReactiveCallback?
There was a problem hiding this comment.
no, a lot of callbacks don't use all the methods
| from event_model.documents.run_stop import RunStop | ||
|
|
||
|
|
||
| class PlanReactiveCallback(CallbackBase): |
There was a problem hiding this comment.
Might be useful to have a brief comment explaining that this should be used when we only want callbacks while a plan is running
olliesilvester
left a comment
There was a problem hiding this comment.
This looks neat! There's a double import I've mentioned on the comments, but it looks like everything here should work okay.
Fixes #951
Adds a class in between our callbacks and
CallbackBasewhich adds functions gated by an activity flag which is set and unset on receiving appropriate documents from theRunEngineTo test: