caproto.server.scan_wrapper

caproto.server.scan_wrapper(scan_function: Scan, period: float, *, subtract_elapsed: bool = True, stop_on_error: bool = False, failure_severity: AlarmSeverity = AlarmSeverity.MAJOR_ALARM, use_scan_field: bool = 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.