tooz/examples/coordinator_heartbeat.py
Julien Danjou fd368a706b doc: switch examples to Zake
This avoids having Zookeeper or memcached running, which might not be
the case.

Change-Id: Ib66eb8348aece447ee2c8de084c4ac807b552907
2014-11-18 15:39:05 +01:00

16 lines
274 B
Python

import time
from tooz import coordination
ALIVE_TIME = 5
coordinator = coordination.get_coordinator('zake://', b'host-1')
coordinator.start()
start = time.time()
while time.time() - start < ALIVE_TIME:
coordinator.heartbeat()
time.sleep(0.1)
coordinator.stop()