def add(self, wait=True): interface = '127.0.0.%s' % (len(self.nodes)+1) node = start(self.leader, self.replica_factor, interface) self.nodes.append(node) if wait: node.ready.wait() return node
import sys import os from miyamoto import start interface = os.environ.get('INTERFACE') leader = os.environ.get('LEADER', interface) replicas = int(os.environ.get('REPLICAS', 2)) print "%s: Using leader %s..." % (interface, leader) start(leader, replicas, interface)