Helper functions for ZooKeeper with kazoo
Project description
k3zkutil
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file k3zkutil-0.1.6.tar.gz.
File metadata
- Download URL: k3zkutil-0.1.6.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8eabbf357d8c7ed21080456a32dc4b3f339754d9799f8f43257c93ac01cab02f
|
|
| MD5 |
3395470852081d08ce6554793265136b
|
|
| BLAKE2b-256 |
729e8a8486822cdf01cd84610cd16a26e28d04bb54f8b8d8e3d377d280077b11
|
File details
Details for the file k3zkutil-0.1.6-py3-none-any.whl.
File metadata
- Download URL: k3zkutil-0.1.6-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6030c3aacd5211a77e2b26aaf1483464e606403bb6768defd8f98c3e004102b
|
|
| MD5 |
d293b5a74a2f5281b98d2432a61939e2
|
|
| BLAKE2b-256 |
f6498a7a3bc5d44317cd01e064f682f7dad51178863757858ded6ae5bb38c348
|