Skip to main content

Helper functions for ZooKeeper with kazoo

Project description

k3zkutil

Action-CI Build Status Documentation Status Package

Some helper function to make life easier with zookeeper.

k3zkutil is a component of pykit3 project: a python3 toolkit set.

Some helper function to make life easier with zookeeper.

Install

pip install k3zkutil

Synopsis

from k3zkutil import config
"""
config.zk_acl      # (('xp', '123', 'cdrwa'), ('foo', 'bar', 'rw'))
config.zk_auth     # ('digest', 'xp', '123')
config.zk_hosts    # '127.0.0.1:2181'
config.zk_node_id  # 'web-01'
config.zk_lock_dir # 'lock/'
"""
with k3zkutil.ZKLock('foo_lock',
                   zkconf=dict(
                       hosts='127.0.0.1:2181',
                       acl=(('xp', '123', 'cdrwa'),),
                       auth=('digest', 'xp', '123'),
                       node_id='web-3',
                       lock_dir='my_locks/'
                   )):
    print("do something")
lock = k3zkutil.ZKLock('foo')
try:
    for holder, ver in lock.acquire_loop(timeout=3):
        print('lock is currently held by:', holder, ver)

    print('lock is acquired')
except k3zkutil.LockTimeout as e:
    print('timeout to acquire "foo"')

Author

Zhang Yanpo (张炎泼) drdr.xp@gmail.com

Copyright and License

The MIT License (MIT)

Copyright (c) 2015 Zhang Yanpo (张炎泼) drdr.xp@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

k3zkutil-0.1.4.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

k3zkutil-0.1.4-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file k3zkutil-0.1.4.tar.gz.

File metadata

  • Download URL: k3zkutil-0.1.4.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for k3zkutil-0.1.4.tar.gz
Algorithm Hash digest
SHA256 92947f5a73d751aaf06dac5d4d83b1b8f259d6b1c8a11374528e90dc8a652b39
MD5 9ccc158ed24801efb90792bf840afd96
BLAKE2b-256 7817156762d251a75a8bbe9b437f571a504254e91165779a0af407953efb01a4

See more details on using hashes here.

File details

Details for the file k3zkutil-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: k3zkutil-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for k3zkutil-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 aab32ba7fde28a92f7cf3681dea8f5729dd4120de604cc4790570e2e595e60a2
MD5 a0b9f3e4763e0eda8ddb0a57819113b1
BLAKE2b-256 1f8866509f3c57fa3eeedb3afde6dcb680ffcefbcea19213ab003685cb23de50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page