snsary.outputs.batch_output

Depending on the output, it may be more efficient to dispatch multiple Readings together. This can be done by inheriting from BatchOutput, which requires a publish_batch method.

BatchOutput protects against concurrent execution of its publish method. BatchOutput is also a Service and will try to publish any remaining Readings when told to stop().

Module Contents

class snsary.outputs.batch_output.BatchOutput(*, max_size=100, max_wait_seconds=10)

Bases: snsary.outputs.output.Output, snsary.system.Service

flush()
stop()

Called asynchronously by the system module when a program is stopping. The execution will eventually time out to ensure the overall program stops in good time.

publish(reading)
abstract publish_batch(readings)