kazoo
See salt.modules.zookeeper
for setup instructions.
This module allows you to acquire and release a slot. This is primarily useful for ensureing that no more than N hosts take a specific action at once. This can also be used to coordinate between masters.
Get lock (with optional timeout)
The path in zookeeper where the lock is
zookeeper connect string
Name to identify this minion, if unspecified defaults to the hostname
Maximum number of lock holders
timeout to wait for the lock. A None timeout will block forever
Whether the locks in zookeper should be ephemeral
Forcibly acquire the lock regardless of available slots
Example:
salt minion zk_concurrency.lock /lock/path host1:1234,host2:1234
Return an un-ordered list of lock holders
The path in zookeeper where the lock is
zookeeper connect string
Name to identify this minion, if unspecified defaults to hostname
Maximum number of lock holders
timeout to wait for the lock. A None timeout will block forever
Whether the locks in zookeper should be ephemeral
Example:
salt minion zk_concurrency.lock_holders /lock/path host1:1234,host2:1234
Get the List of identifiers in a particular party, optionally waiting for the specified minimum number of nodes (min_nodes) to appear
The path in zookeeper where the lock is
zookeeper connect string
The minimum number of nodes expected to be present in the party
The boolean indicating if we need to block until min_nodes are available
Example:
salt minion zk_concurrency.party_members /lock/path host1:1234,host2:1234
salt minion zk_concurrency.party_members /lock/path host1:1234,host2:1234 min_nodes=3 blocking=True
Remove lease from semaphore
The path in zookeeper where the lock is
zookeeper connect string
Name to identify this minion, if unspecified defaults to hostname
Maximum number of lock holders
timeout to wait for the lock. A None timeout will block forever
Whether the locks in zookeper should be ephemeral
Example:
salt minion zk_concurrency.unlock /lock/path host1:1234,host2:1234