set_transaction#

BaseInstrument.set_transaction() ContextManager[source]#

Context manager for a transactional set.

Can be used as a context in a with statement and bundles all node set commands into a single transaction. This reduces the network overhead and often increases the speed.

Within the with block a set commands to a node will be buffered and bundled into a single command at the end automatically. (All other operations, e.g. getting the value of a node, will not be affected)

Warning

The set is always performed as deep set if called on device nodes.

Examples

>>> with device.set_transaction():
        device.test[0].a(1)
        device.test[1].a(2)
Return type:

ContextManager