set_transaction#
- Session.set_transaction() Generator[None, None, None] [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.
In comparison to the device level transaction manager this manager affects all devices that are connected to the Session and bundles all set commands into a single transaction.
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 session.set_transaction(): device1.test[0].a(1) device2.test[0].a(2)
New in version 0.4.0.
- Return type:
Generator[None, None, None]