【发布时间】:2013-10-29 23:35:18
【问题描述】:
我阅读了kazoo 的文档。 然后我在网站上运行了代码示例,每次运行时都会调用watch的func,我想阻止程序直到删除一个节点的子节点,我该怎么做?
当前代码:
#!/usr/bin/env python3
from kazoo.client import KazooClient
zk = KazooClient(hosts='127.0.0.1:2181')
zk.start()
@zk.ChildrenWatch("/distribute-lock")
def watch_children(children):
print("Children are now: %s" % children)
children = zk.exists("/distribute-lock/childnode-325", watch=watch_children)
print(children)
zk.stop()
【问题讨论】:
标签: python-3.x apache-zookeeper watch kazoo