本文整理汇总了Python中couchbase.cluster.Cluster.async_load_gen_docs方法的典型用法代码示例。如果您正苦于以下问题:Python Cluster.async_load_gen_docs方法的具体用法?Python Cluster.async_load_gen_docs怎么用?Python Cluster.async_load_gen_docs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类couchbase.cluster.Cluster
的用法示例。
在下文中一共展示了Cluster.async_load_gen_docs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BaseTestCase
# 需要导入模块: from couchbase.cluster import Cluster [as 别名]
# 或者: from couchbase.cluster.Cluster import async_load_gen_docs [as 别名]
#.........这里部分代码省略.........
'password',
self.bucket_size,
self.num_replicas))
self.buckets[name] = {1 : KVStore()}
for task in bucket_tasks:
task.result()
def _verify_stats_all_buckets(self, servers):
stats_tasks = []
for bucket, kv_stores in self.buckets.items():
items = sum([len(kv_store) for kv_store in kv_stores.values()])
stats_tasks.append(self.cluster.async_wait_for_stats(servers, bucket, '',
'curr_items', '==', items))
stats_tasks.append(self.cluster.async_wait_for_stats(servers, bucket, '',
'vb_active_curr_items', '==', items))
available_replicas = self.num_replicas
if len(servers) == self.num_replicas:
available_replicas = len(servers) - 1
elif len(servers) <= self.num_replicas:
available_replicas = len(servers) - 1
stats_tasks.append(self.cluster.async_wait_for_stats(servers, bucket, '',
'vb_replica_curr_items', '==', items * available_replicas))
stats_tasks.append(self.cluster.async_wait_for_stats(servers, bucket, '',
'curr_items_tot', '==', items * (available_replicas + 1)))
for task in stats_tasks:
task.result(60)
"""Asynchronously applys load generation to all bucekts in the cluster.
Args:
server - A server in the cluster. (TestInputServer)
kv_gen - The generator to use to generate load. (DocumentGenerator)
op_type - "create", "read", "update", or "delete" (String)
exp - The expiration for the items if updated or created (int)
kv_store - The index of the bucket's kv_store to use. (int)
Returns:
A list of all of the tasks created.
"""
def _async_load_all_buckets(self, server, kv_gen, op_type, exp, kv_store=1):
tasks = []
for bucket, kv_stores in self.buckets.items():
gen = copy.deepcopy(kv_gen)
tasks.append(self.cluster.async_load_gen_docs(server, bucket, gen,
kv_stores[kv_store],
op_type, exp))
return tasks
"""Synchronously applys load generation to all bucekts in the cluster.
Args:
server - A server in the cluster. (TestInputServer)
kv_gen - The generator to use to generate load. (DocumentGenerator)
op_type - "create", "read", "update", or "delete" (String)
exp - The expiration for the items if updated or created (int)
kv_store - The index of the bucket's kv_store to use. (int)
"""
def _load_all_buckets(self, server, kv_gen, op_type, exp, kv_store=1):
tasks = self._async_load_all_buckets(server, kv_gen, op_type, exp, kv_store)
for task in tasks:
task.result()
"""Waits for queues to drain on all servers and buckets in a cluster.
A utility function that waits for all of the items loaded to be persisted
and replicated.
Args:
servers - A list of all of the servers in the cluster. ([TestInputServer])
"""
def _wait_for_stats_all_buckets(self, servers):
tasks = []
for server in servers:
for bucket in self.buckets:
tasks.append(self.cluster.async_wait_for_stats([server], bucket, '',
'ep_queue_size', '==', 0))
tasks.append(self.cluster.async_wait_for_stats([server], bucket, '',
'ep_flusher_todo', '==', 0))
for task in tasks:
task.result()
"""Verifies data on all of the nodes in a cluster.
Verifies all of the data in a specific kv_store index for all buckets in
the cluster.
Args:
server - A server in the cluster. (TestInputServer)
kv_store - The kv store index to check. (int)
"""
def _verify_all_buckets(self, server, kv_store=1):
tasks = []
for bucket, kv_stores in self.buckets.items():
tasks.append(self.cluster.async_verify_data(server, bucket, kv_stores[kv_store]))
for task in tasks:
task.result()
示例2: FailoverBaseTest
# 需要导入模块: from couchbase.cluster import Cluster [as 别名]
# 或者: from couchbase.cluster.Cluster import async_load_gen_docs [as 别名]
#.........这里部分代码省略.........
self.buckets.append(Bucket(name="default", authType="sasl", saslPassword="",
num_replicas=self._num_replicas, bucket_size=self.bucket_size))
self._create_sasl_buckets(self.master, self._sasl_buckets)
self._create_standard_buckets(self.master, self._standard_buckets)
def _create_sasl_buckets(self, server, num_buckets):
bucket_tasks = []
for i in range(num_buckets):
name = 'bucket' + str(i)
bucket_tasks.append(self._cluster_helper.async_create_sasl_bucket(server, name,
'password',
self.bucket_size,
self._num_replicas))
self.buckets.append(Bucket(name=name, authType="sasl", saslPassword='password',
num_replicas=self._num_replicas, bucket_size=self.bucket_size));
for task in bucket_tasks:
task.result()
def _create_standard_buckets(self, server, num_buckets):
bucket_tasks = []
for i in range(num_buckets):
name = 'standard_bucket' + str(i)
bucket_tasks.append(self._cluster_helper.async_create_standard_bucket(server, name,
11214 + i,
self.bucket_size,
self._num_replicas))
self.buckets.append(Bucket(name=name, authType=None, saslPassword=None, num_replicas=self._num_replicas,
bucket_size=self.bucket_size, port=11214 + i));
for task in bucket_tasks:
task.result()
def _async_load_all_buckets(self, server, kv_gen, op_type, exp, kv_store=1, flag=0, only_store_hash=True, batch_size=1, pause_secs=1, timeout_secs=30):
tasks = []
for bucket in self.buckets:
gen = copy.deepcopy(kv_gen)
tasks.append(self._cluster_helper.async_load_gen_docs(server, bucket.name, gen,
bucket.kvs[kv_store],
op_type, exp, flag, only_store_hash, batch_size, pause_secs, timeout_secs))
return tasks
def _load_all_buckets(self, server, kv_gen, op_type, exp, kv_store=1, flag=0, only_store_hash=True, batch_size=1, pause_secs=1, timeout_secs=30):
tasks = self._async_load_all_buckets(server, kv_gen, op_type, exp, kv_store, flag, only_store_hash, batch_size, pause_secs, timeout_secs)
for task in tasks:
task.result()
def _wait_for_stats_all_buckets(self, servers):
tasks = []
for server in servers:
for bucket in self.buckets:
tasks.append(self._cluster_helper.async_wait_for_stats([server], bucket, '',
'ep_queue_size', '==', 0))
tasks.append(self._cluster_helper.async_wait_for_stats([server], bucket, '',
'ep_flusher_todo', '==', 0))
for task in tasks:
task.result()
def _wait_for_replication(self, servers, timeout=600):
tasks = []
for server in servers:
for bucket in self.buckets:
for server_repl in list(set(servers) - set([server])):
tasks.append(self._cluster_helper.async_wait_for_stats([server], bucket, 'tap',
'eq_tapq:[email protected]' + server_repl.ip + ':idle', '==', 'true'))
tasks.append(self._cluster_helper.async_wait_for_stats([server], bucket, 'tap',
'eq_tapq:[email protected]' + server_repl.ip + ':backfill_completed', '==', 'true'))
for task in tasks:
task.result(timeout)
def _verify_all_buckets(self, server, kv_store=1, timeout=180, max_verify=None, only_store_hash=True, batch_size=1):
tasks = []
for bucket in self.buckets:
tasks.append(self._cluster_helper.async_verify_data(server, bucket, bucket.kvs[kv_store], max_verify, only_store_hash, batch_size))
for task in tasks:
task.result(timeout)
def _verify_stats_all_buckets(self, servers):
stats_tasks = []
for bucket in self.buckets:
items = sum([len(kv_store) for kv_store in bucket.kvs.values()])
stats_tasks.append(self._cluster_helper.async_wait_for_stats(servers, bucket, '',
'curr_items', '==', items))
stats_tasks.append(self._cluster_helper.async_wait_for_stats(servers, bucket, '',
'vb_active_curr_items', '==', items))
available_replicas = self._num_replicas
if len(servers) == self._num_replicas:
available_replicas = len(servers) - 1
elif len(servers) <= self._num_replicas:
available_replicas = len(servers) - 1
stats_tasks.append(self._cluster_helper.async_wait_for_stats(servers, bucket, '',
'vb_replica_curr_items', '==', items * available_replicas))
stats_tasks.append(self._cluster_helper.async_wait_for_stats(servers, bucket, '',
'curr_items_tot', '==', items * (available_replicas + 1)))
for task in stats_tasks:
task.result(60)
示例3: BaseTestCase
# 需要导入模块: from couchbase.cluster import Cluster [as 别名]
# 或者: from couchbase.cluster.Cluster import async_load_gen_docs [as 别名]
#.........这里部分代码省略.........
available_replicas = self.num_replicas
if len(servers) == self.num_replicas:
available_replicas = len(servers) - 1
elif len(servers) <= self.num_replicas:
available_replicas = len(servers) - 1
stats_tasks.append(self.cluster.async_wait_for_stats(servers, bucket, '',
'vb_replica_curr_items', '==', items * available_replicas))
stats_tasks.append(self.cluster.async_wait_for_stats(servers, bucket, '',
'curr_items_tot', '==', items * (available_replicas + 1)))
for task in stats_tasks:
task.result(60)
"""Asynchronously applys load generation to all bucekts in the cluster.
bucket.name, gen,
bucket.kvs[kv_store],
op_type, exp
Args:
server - A server in the cluster. (TestInputServer)
kv_gen - The generator to use to generate load. (DocumentGenerator)
op_type - "create", "read", "update", or "delete" (String)
exp - The expiration for the items if updated or created (int)
kv_store - The index of the bucket's kv_store to use. (int)
Returns:
A list of all of the tasks created.
"""
def _async_load_all_buckets(self, server, kv_gen, op_type, exp, kv_store=1, flag=0, only_store_hash=True, batch_size=1, pause_secs=1, timeout_secs=30):
tasks = []
for bucket in self.buckets:
gen = copy.deepcopy(kv_gen)
tasks.append(self.cluster.async_load_gen_docs(server, bucket.name, gen,
bucket.kvs[kv_store],
op_type, exp, flag, only_store_hash, batch_size, pause_secs, timeout_secs))
return tasks
"""Synchronously applys load generation to all bucekts in the cluster.
Args:
server - A server in the cluster. (TestInputServer)
kv_gen - The generator to use to generate load. (DocumentGenerator)
op_type - "create", "read", "update", or "delete" (String)
exp - The expiration for the items if updated or created (int)
kv_store - The index of the bucket's kv_store to use. (int)
"""
def _load_all_buckets(self, server, kv_gen, op_type, exp, kv_store=1, flag=0, only_store_hash=True, batch_size=1, pause_secs=1, timeout_secs=30):
tasks = self._async_load_all_buckets(server, kv_gen, op_type, exp, kv_store, flag, only_store_hash, batch_size, pause_secs, timeout_secs)
for task in tasks:
task.result()
"""Waits for queues to drain on all servers and buckets in a cluster.
A utility function that waits for all of the items loaded to be persisted
and replicated.
Args:
servers - A list of all of the servers in the cluster. ([TestInputServer])
"""
def _wait_for_stats_all_buckets(self, servers):
tasks = []
for server in servers:
for bucket in self.buckets:
tasks.append(self.cluster.async_wait_for_stats([server], bucket, '',
'ep_queue_size', '==', 0))
示例4: BaseTestCase
# 需要导入模块: from couchbase.cluster import Cluster [as 别名]
# 或者: from couchbase.cluster.Cluster import async_load_gen_docs [as 别名]
#.........这里部分代码省略.........
available_replicas = self.num_replicas
if len(servers) == self.num_replicas:
available_replicas = len(servers) - 1
elif len(servers) <= self.num_replicas:
available_replicas = len(servers) - 1
stats_tasks.append(self.cluster.async_wait_for_stats(servers, bucket, '',
'vb_replica_curr_items', '==', items * available_replicas))
stats_tasks.append(self.cluster.async_wait_for_stats(servers, bucket, '',
'curr_items_tot', '==', items * (available_replicas + 1)))
for task in stats_tasks:
task.result(60)
"""Asynchronously applys load generation to all bucekts in the cluster.
bucket.name, gen,
bucket.kvs[kv_store],
op_type, exp
Args:
server - A server in the cluster. (TestInputServer)
kv_gen - The generator to use to generate load. (DocumentGenerator)
op_type - "create", "read", "update", or "delete" (String)
exp - The expiration for the items if updated or created (int)
kv_store - The index of the bucket's kv_store to use. (int)
Returns:
A list of all of the tasks created.
"""
def _async_load_all_buckets(self, server, kv_gen, op_type, exp, kv_store=1, flag=0, only_store_hash=True, batch_size=1, pause_secs=1, timeout_secs=30):
tasks = []
for bucket in self.buckets:
gen = copy.deepcopy(kv_gen)
tasks.append(self.cluster.async_load_gen_docs(server, bucket.name, gen,
bucket.kvs[kv_store],
op_type, exp, flag, only_store_hash, batch_size, pause_secs, timeout_secs))
return tasks
"""Synchronously applys load generation to all bucekts in the cluster.
Args:
server - A server in the cluster. (TestInputServer)
kv_gen - The generator to use to generate load. (DocumentGenerator)
op_type - "create", "read", "update", or "delete" (String)
exp - The expiration for the items if updated or created (int)
kv_store - The index of the bucket's kv_store to use. (int)
"""
def _load_all_buckets(self, server, kv_gen, op_type, exp, kv_store=1, flag=0, only_store_hash=True, batch_size=1000, pause_secs=1, timeout_secs=30):
tasks = self._async_load_all_buckets(server, kv_gen, op_type, exp, kv_store, flag, only_store_hash, batch_size, pause_secs, timeout_secs)
for task in tasks:
task.result()
"""Waits for queues to drain on all servers and buckets in a cluster.
A utility function that waits for all of the items loaded to be persisted
and replicated.
Args:
servers - A list of all of the servers in the cluster. ([TestInputServer])
"""
def _wait_for_stats_all_buckets(self, servers):
tasks = []
for server in servers:
for bucket in self.buckets:
tasks.append(self.cluster.async_wait_for_stats([server], bucket, '',
'ep_queue_size', '==', 0))