示例#1
0
 def cluster_and_pool(self,
                      num_nodes=10,
                      pool_size=5,
                      start=True,
                      cluster_class=None,
                      api_version=None):
     if cluster_class is None:
         cluster_class = FakeCassandraCluster
     cluster = cluster_class(num_nodes, start_port=self.start_port)
     pool = CassandraClusterPool([cluster.iface],
                                 thrift_port=self.start_port,
                                 pool_size=pool_size,
                                 api_version=api_version)
     if start:
         cluster.startService()
         pool.startService()
     self.cluster = cluster
     self.pool = pool
     try:
         yield cluster, pool
     finally:
         del self.pool
         del self.cluster
         if pool.running:
             pool.stopService()
         if cluster.running:
             cluster.stopService()
 def cluster_and_pool(self,
                      num_nodes=10,
                      pool_size=5,
                      start=True,
                      cluster_class=None,
                      node_discovery=True,
                      fill_throttle=0.0):
     if cluster_class is None:
         cluster_class = FakeCassandraCluster
     cluster = cluster_class(num_nodes, start_port=self.start_port)
     pool = CassandraClusterPool([cluster.iface],
                                 thrift_port=self.start_port,
                                 pool_size=pool_size,
                                 auto_node_discovery=node_discovery,
                                 fill_pool_throttle=fill_throttle)
     if start:
         cluster.startService()
         pool.startService()
     self.cluster = cluster
     self.pool = pool
     try:
         yield cluster, pool
     finally:
         del self.pool
         del self.cluster
         if pool.running:
             pool.stopService()
         if cluster.running:
             cluster.stopService()