Module Expr Str ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults vararg kwarg body Expr Str If UnaryOpNot Call NameLoad NameLoad body Raise Call NameLoad Str TryExcept body With AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Pass decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list
N/A N/A ZooKeeper Leader Elections

:Maintainer: None
:Status: Unknown

 kazoo.exceptions CancelledError Election N/A object N/A N/A Kazoo Basic Leader Election

    Example usage with a :class:`~kazoo.client.KazooClient` instance::

        zk = KazooClient()
        zk.start()
        election = zk.Election("/electionpath", "my-identifier")

        # blocks until the election is won, then calls
        # my_leader_function()
        election.run(my_leader_function)

     __init__ N/A N/A self client path identifier N/A None N/A N/A Create a Kazoo Leader Election

        :param client: A :class:`~kazoo.client.KazooClient` instance.
        :param path: The election path to use.
        :param identifier: Name to use for this lock contender. This
                           can be useful for querying to see who the
                           current lock contenders are.

         N/A N/A self lock N/A N/A client Lock path identifier N/A run N/A N/A self func N/A args kwargs N/A N/A Contend for the leadership

        This call will block until either this contender is cancelled
        or this contender wins the election and the provided leadership
        function subsequently returns or fails.

        :param func: A function to be called if/when the election is
                     won.
        :param args: Arguments to leadership function.
        :param kwargs: Keyword arguments to leadership function.

         N/A N/A N/A callable func N/A N/A N/A ValueError leader function is not callable N/A N/A N/A N/A self lock N/A N/A N/A func args kwargs N/A N/A N/A CancelledError N/A N/A N/A cancel N/A N/A self N/A N/A N/A Cancel participation in the election

        .. note::

            If this contender has already been elected leader, this
            method will not interrupt the leadership function.

         N/A N/A N/A N/A self lock cancel N/A contenders N/A N/A self N/A N/A N/A Return an ordered list of the current contenders in the
        election

        .. note::

            If the contenders did not set an identifier, it will appear
            as a blank string.

         N/A N/A N/A N/A self lock contenders N/A N/A