kazoo.recipe.barrier
¶
Zookeeper Barriers
- Maintainer:
None
- Status:
Unknown
Public API¶
- class kazoo.recipe.barrier.Barrier(client, path)[source]¶
Kazoo Barrier
Implements a barrier to block processing of a set of nodes until a condition is met at which point the nodes will be allowed to proceed. The barrier is in place if its node exists.
Warning
The
wait()
function does not handle connection loss and may raiseConnectionLossException
if the connection is lost while waiting.
- __init__(client, path)[source]¶
Create a Kazoo Barrier
- Parameters:
client – A
KazooClient
instance.path – The barrier path to use.
- class kazoo.recipe.barrier.DoubleBarrier(client, path, num_clients, identifier=None)[source]¶
Kazoo Double Barrier
Double barriers are used to synchronize the beginning and end of a distributed task. The barrier blocks when entering it until all the members have joined, and blocks when leaving until all the members have left.
Note
You should register a listener for session loss as the process will no longer be part of the barrier once the session is gone. Connection losses will be retried with the default retry policy.
- __init__(client, path, num_clients, identifier=None)[source]¶
Create a Double Barrier
- Parameters:
client – A
KazooClient
instance.path – The barrier path to use.
num_clients (int) – How many clients must enter the barrier to proceed.
identifier – An identifier to use for this member of the barrier when participating. Defaults to the hostname + process id.