kazoo.recipe.party

Party

Maintainer:

Ben Bangert <ben@groovie.org>

Status:

Production

A Zookeeper pool of party members. The Party object can be used for determining members of a party.

Public API

class kazoo.recipe.party.Party(client, path, identifier=None)[source]

Simple pool of participating processes

__init__(client, path, identifier=None)[source]
Parameters:
  • client – A KazooClient instance.

  • path – The party path to use.

  • identifier – An identifier to use for this member of the party when participating.

__iter__()[source]

Get a list of participating clients’ data values

__len__()

Return a count of participating clients

join()

Join the party

leave()

Leave the party

class kazoo.recipe.party.ShallowParty(client, path, identifier=None)[source]

Simple shallow pool of participating processes

This differs from the Party as the identifier is used in the name of the party node itself, rather than the data. This places some restrictions on the length as it must be a valid Zookeeper node (an alphanumeric string), but reduces the overhead of getting a list of participants to a single Zookeeper call.

__init__(client, path, identifier=None)[source]
Parameters:
  • client – A KazooClient instance.

  • path – The party path to use.

  • identifier – An identifier to use for this member of the party when participating.

__iter__()[source]

Get a list of participating clients’ identifiers

__len__()

Return a count of participating clients

join()

Join the party

leave()

Leave the party