Some helper function to make life easier with zookeeper.
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
Release history Release notifications | RSS feed
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.0.tar.gz
(15.7 kB
view details)
Built Distribution
k3zkutil-0.1.0-py3-none-any.whl
(18.0 kB
view details)
File details
Details for the file k3zkutil-0.1.0.tar.gz
.
File metadata
- Download URL: k3zkutil-0.1.0.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d2f5c581f716715f909390fbd400b642a6f828a4c30b2e36410b4231245daef |
|
MD5 | 278d32c2859d238253033768bcb23add |
|
BLAKE2b-256 | 1210bf18013037c6a3e3dbd7714dc21e3178bb076c038044a78fd65dea24e030 |
File details
Details for the file k3zkutil-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: k3zkutil-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a130029f03ce1d778463adfc8865c2f1740814f88c14aa1f29f026f2426d866 |
|
MD5 | 7dfb64d8c295064e1995da7cdc45767e |
|
BLAKE2b-256 | e825950aa4a811325879ca401a658a0432ffd8128f6fb42b221a9badec1405a1 |