Coordinate distributed systems.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
tooz/examples/lock.py

11 lines
248 B

from tooz import coordination
coordinator = coordination.get_coordinator('zake://', b'host-1')
coordinator.start()
# Create a lock
lock = coordinator.get_lock("foobar")
with lock:
print("Do something that is distributed")
coordinator.stop()