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 (KazooClient) – A KazooClient instance.

  • path (str) – The party path to use.

  • identifier (str | None) – An identifier to use for this member of the party when participating.

__iter__()[source]

Get a list of participating clients’ data values

Return type:

Iterator[str]

__len__()

Return a count of participating clients

Return type:

int

join()

Join the party

Return type:

None

leave()

Leave the party

Return type:

bool

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 (KazooClient) – A KazooClient instance.

  • path (str) – The party path to use.

  • identifier (str | None) – An identifier to use for this member of the party when participating.

__iter__()[source]

Get a list of participating clients’ identifiers

Return type:

Iterator[str]

__len__()

Return a count of participating clients

Return type:

int

join()

Join the party

Return type:

None

leave()

Leave the party

Return type:

bool