caproto.server.scan_wrapper¶
-
caproto.server.
scan_wrapper
(scan_function, period, *, subtract_elapsed=True, stop_on_error=False, failure_severity=<AlarmSeverity.MAJOR_ALARM: 2>, use_scan_field=False)[source]¶ Wrap a function intended for pvproperty.scan with common logic to periodically call it.
- Parameters
- scan_functionasync callable
- The scan function to wrap, with expected signature:
(group, instance, async_library)
- periodfloat
Wait period seconds between calls to the scanned function
- subtract_elapsedbool, optional
Subtract the elapsed time of the previous call from the period for the subsequent iteration
- stop_on_errorbool, optional
Fail (and stop scanning) when unhandled exceptions occur
- use_scan_fieldbool, optional
Use the .SCAN field if this pvproperty is a mocked record. Raises ValueError if
record
is not used.
- Returns
- wrappedcallable
The wrapped
scan
function.