begin = time.time()
while not self._stop.is_set():
servers = self._etcd.get_service(ETCD_POD_RANK)
ranks = {}
for s in servers:
ranks[int(s.server)] = s.info
//logger.info("ranks:{}".format(ranks))
new_cluster = Cluster()
with self._lock:
if self._ranks is None:
self._ranks = ranks
self._cluster.from_json(ranks)
//logger.info("clusters:{}".format(self._cluster))
continue
After Change
// update the cluster info.
self._cluster = copy.copy(self._new_cluster)
time.sleep(3)
@property
def changed(self):
with self._lock: