def send_ring_rest (self, path, base_msg): """access a REST endpoint on each of the shards""" json_str = [] for shard_id, (shard_uri, exe_info) in self._shard_assoc.items(): lines = post_distrib_rest(self.prefix, shard_id, shard_uri, path, base_msg) json_str.append(lines[0]) return json_str
def send_ring_rest(self, path, base_msg): """access a REST endpoint on each of the shards""" json_str = [] for shard_id, (shard_uri, exe_info) in self._shard_assoc.items(): lines = post_distrib_rest(self.prefix, shard_id, shard_uri, path, base_msg) json_str.append(lines[0]) return json_str
def reify (self, indiv): """test/add a newly generated Individual into the Population (birth)""" neighbor_shard_id = None shard_uri = None if self._hash_ring: neighbor_shard_id = self._hash_ring.get_node(indiv.key) if neighbor_shard_id != self._shard_id: shard_uri = self._shard_dict[neighbor_shard_id] # distribute the tasks in this phase throughout the HashRing, # using a remote task_queue with synchronization based on a # barrier pattern if shard_uri: msg = { "key": indiv.key, "gen": indiv.gen, "feature_set": loads(indiv.get_json_feature_set()) } lines = post_distrib_rest(self.prefix, neighbor_shard_id, shard_uri, "pop/reify", msg) return False else: return self._reify_locally(indiv)
def send_worker_rest(self, shard_id, shard_uri, path, base_msg): """access a REST endpoint on the specified shard""" return post_distrib_rest(self.prefix, shard_id, shard_uri, path, base_msg)
def send_worker_rest (self, shard_id, shard_uri, path, base_msg): """access a REST endpoint on the specified shard""" return post_distrib_rest(self.prefix, shard_id, shard_uri, path, base_msg)