def get_cluster_topology()

in cstar/job.py [0:0]


    def get_cluster_topology(self, seed_nodes):
        cluster_names = list()
        self.schema_versions = list()
        self.status_topology_hash = list()
        topologies = list()
        count = 0
        tried_hosts = []
        for host in seed_nodes:
            tried_hosts.append(host)
            conn = self._connection(host)

            describe_res = self.run_nodetool(conn, "describecluster")
            status_res = self.run_nodetool(conn, "status")
            if (describe_res.status == 0) and (status_res.status == 0):
                (cluster_name, schema_version) = cstar.nodetoolparser.parse_describe_cluster(describe_res.out)
                if cluster_name not in cluster_names:
                    cluster_names.append(cluster_name)
                    topologies.append(cstar.nodetoolparser.parse_nodetool_status(status_res.out, cluster_name, self.reverse_dns_preheat, self.resolve_hostnames))
                    self.schema_versions.append(schema_version)
                    self.status_topology_hash.append(topologies[len(topologies) - 1].get_hash())


            count += 1
            if count >= MAX_ATTEMPTS:
                break
        if len(topologies) > 0:
            final_topology = set()
            for i in range(len(topologies)):
                final_topology.update(topologies[i].hosts)
            return Topology(final_topology)
        raise HostIsDown("Could not find any working host while fetching topology. Is Cassandra actually running? Tried the following hosts:",
                         ", ".join([x.ip for x in tried_hosts]))