def __init__(self, cluster, nodes): """ Initializes the client """ cleaned_nodes = {} for node, info in nodes.iteritems(): cleaned_nodes[str(node)] = ([str(entry) for entry in info[0]], int(info[1])) self._config = ArakoonClientConfig(str(cluster), cleaned_nodes) self._client = ArakoonClient(self._config) self._identifier = int(round(random.random() * 10000000)) self._lock = Lock() self._batch_size = 500 self._sequences = {}
def __init__(self, cluster): """ Initializes the client """ contents = EtcdConfiguration.get( PyrakoonStore.ETCD_CONFIG_KEY.format(cluster), raw=True) parser = RawConfigParser() parser.readfp(StringIO(contents)) nodes = {} for node in parser.get('global', 'cluster').split(','): node = node.strip() nodes[node] = ([str(parser.get(node, 'ip'))], int(parser.get(node, 'client_port'))) self._config = ArakoonClientConfig(str(cluster), nodes) self._client = ArakoonClient(self._config) self._identifier = int(round(random.random() * 10000000)) self._lock = Lock() self._batch_size = 500 self._sequences = {}