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
import k3zkutil
"""
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={
"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:
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
Metadata
Release files for k3zkutil 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| k3zkutil-0.1.8.tar.gz | 23.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| k3zkutil-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.7 kB
Release files / k3zkutil-0.1.8.tar.gz
| Download URL | k3zkutil-0.1.8.tar.gz |
|---|---|
| Size | 23.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9151f1270dfd275d81ff561760acbcbcffebc68f203a1ad21a860d22bde0a583
|
|
BLAKE2b-256 checksum How to use checksums |
8104a86bef95e02401d20d21894f5be9483181ae8af48dd256662602b34a9565
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / k3zkutil-0.1.8-py3-none-any.whl
| Download URL | k3zkutil-0.1.8-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
090fb8d122be10e5c37eddff4af6aa62d0b4a6b9589529eb94fef50c2c3e8c28
|
|
BLAKE2b-256 checksum How to use checksums |
f94dc60fe9e5e298ca28667631a45190d5019e60d290b6288258b751ef00bfaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|