Skip to main content

k3zkutil

Action-CI 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

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.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for k3zkutil 0.1.10
File Size Uploaded
k3zkutil-0.1.10.tar.gz 25.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for k3zkutil 0.1.10
File Interpreter ABI Platform
k3zkutil-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 43.3 kB

Release files / k3zkutil-0.1.10.tar.gz

Download URL k3zkutil-0.1.10.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
dfe9bcf9f636d1ef08fe5b0f3d461c09c52dce5c4be5bcaa57a190de3179c005
BLAKE2b-256 checksum
How to use checksums
2120e12dd94799a708f51fd90707c9a375d86e895a798ef0cd088e69d802c34e
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.10-py3-none-any.whl

Download URL k3zkutil-0.1.10-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12c8a8a0ff8c5688a6e96c89b90c3eb7ba2775a77e51e949ce3454b8b62c5441
BLAKE2b-256 checksum
How to use checksums
d5d149c11725d634dc0e0fa478c34aef5c48fdaa3d0bf19f4c64427f88b54a50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page