本文整理汇总了Python中ccmlib.cluster.Cluster.set_log_level方法的典型用法代码示例。如果您正苦于以下问题:Python Cluster.set_log_level方法的具体用法?Python Cluster.set_log_level怎么用?Python Cluster.set_log_level使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ccmlib.cluster.Cluster
的用法示例。
在下文中一共展示了Cluster.set_log_level方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import set_log_level [as 别名]
def run(self):
try:
cluster = Cluster(self.path, self.name, cassandra_dir=self.options.cassandra_dir, cassandra_version=self.options.cassandra_version, verbose=True)
except OSError as e:
cluster_dir = os.path.join(self.path, self.name)
import traceback
print >> sys.stderr, 'Cannot create cluster: %s\n%s' % (str(e), traceback.format_exc())
exit(1)
if self.options.partitioner:
cluster.set_partitioner(self.options.partitioner)
if cluster.version() >= "1.2" and self.options.binary_protocol:
cluster.set_configuration_options({ 'start_native_transport' : True })
if cluster.version() >= "1.2" and self.options.vnodes:
cluster.set_configuration_options({ 'num_tokens' : 256 })
if not self.options.no_switch:
common.switch_cluster(self.path, self.name)
print 'Current cluster is now: %s' % self.name
if self.nodes is not None:
try:
if self.options.debug_log:
cluster.set_log_level("DEBUG")
if self.options.trace_log:
cluster.set_log_level("TRACE")
cluster.populate(self.nodes, use_vnodes=self.options.vnodes, ipprefix=self.options.ipprefix)
if self.options.start_nodes:
cluster.start(verbose=self.options.debug, wait_for_binary_proto=self.options.binary_protocol)
except common.ArgumentError as e:
print >> sys.stderr, str(e)
exit(1)
示例2: TestCCMLib
# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import set_log_level [as 别名]
class TestCCMLib(ccmtest.Tester):
def test2(self):
self.cluster = Cluster(CLUSTER_PATH, "test2", cassandra_version='2.0.3')
self.cluster.populate(2)
self.cluster.start()
self.cluster.set_log_level("ERROR")
class FakeNode:
name = "non-existing node"
self.cluster.remove(FakeNode())
[node1, node2] = self.cluster.nodelist()
self.cluster.remove(node1)
self.cluster.show(True)
self.cluster.show(False)
#self.cluster.stress([])
self.cluster.compact()
self.cluster.drain()
self.cluster.stop()
def test3(self):
self.cluster = Cluster(CLUSTER_PATH, "test3", cassandra_version='2.0.3')
self.cluster.populate(2)
self.cluster.start()
self.cluster.cleanup()
self.cluster.clear()
self.cluster.stop()
示例3: run
# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import set_log_level [as 别名]
def run(self):
try:
cluster = Cluster(self.path, self.name, cassandra_dir=self.options.cassandra_dir, cassandra_version=self.options.cassandra_version, verbose=True)
except OSError as e:
cluster_dir = os.path.join(self.path, self.name)
print >> sys.stderr, 'Cannot create cluster: %s' % str(e)
exit(1)
if self.options.partitioner:
cluster.set_partitioner(self.options.partitioner)
if cluster.version() >= "1.2" and self.options.binary_protocol:
cluster.set_configuration_options({ 'start_native_transport' : True })
if not self.options.no_switch:
common.switch_cluster(self.path, self.name)
print 'Current cluster is now: %s' % self.name
if self.nodes is not None:
try:
cluster.set_log_level("DEBUG")
cluster.populate(self.nodes)
if self.options.start_nodes:
cluster.start(verbose=self.options.debug)
except common.ArgumentError as e:
print >> sys.stderr, str(e)
exit(1)
示例4: run
# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import set_log_level [as 别名]
def run(self):
try:
cluster = Cluster(self.path, self.name, cassandra_dir=self.options.cassandra_dir, cassandra_version=self.options.cassandra_version, verbose=True)
except OSError as e:
cluster_dir = os.path.join(self.path, self.name)
import traceback
print_('Cannot create cluster: %s\n%s' % (str(e), traceback.format_exc()), file=sys.stderr)
exit(1)
if self.options.partitioner:
cluster.set_partitioner(self.options.partitioner)
if cluster.version() >= "1.2.5":
self.options.binary_protocol = True
if self.options.binary_protocol:
cluster.set_configuration_options({ 'start_native_transport' : True })
if cluster.version() >= "1.2" and self.options.vnodes:
cluster.set_configuration_options({ 'num_tokens' : 256 })
if not self.options.no_switch:
common.switch_cluster(self.path, self.name)
print_('Current cluster is now: %s' % self.name)
if not (self.options.ipprefix or self.options.ipformat):
self.options.ipformat = '127.0.0.%d'
if self.nodes is not None:
try:
if self.options.debug_log:
cluster.set_log_level("DEBUG")
if self.options.trace_log:
cluster.set_log_level("TRACE")
cluster.populate(self.nodes, use_vnodes=self.options.vnodes, ipprefix=self.options.ipprefix, ipformat=self.options.ipformat)
if self.options.start_nodes:
profile_options = None
if self.options.profile:
profile_options = {}
if self.options.profile_options:
profile_options['options'] = self.options.profile_options
if cluster.start(verbose=self.options.debug, wait_for_binary_proto=self.options.binary_protocol, jvm_args=self.options.jvm_args, profile_options=profile_options) is None:
details = ""
if not self.options.debug:
details = " (you can use --debug for more information)"
print_("Error starting nodes, see above for details%s" % details, file=sys.stderr)
except common.ArgumentError as e:
print_(str(e), file=sys.stderr)
exit(1)
示例5: test2
# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import set_log_level [as 别名]
def test2():
cluster = Cluster(CLUSTER_PATH, "test2", cassandra_version='2.0.3')
cluster.populate(2)
cluster.start()
cluster.set_log_level("ERROR")
class FakeNode:
name = "non-existing node"
cluster.remove(FakeNode())
[node1, node2] = cluster.nodelist()
cluster.remove(node1)
cluster.show(True)
cluster.show(False)
#cluster.stress([])
cluster.compact()
cluster.drain()
cluster.stop()
示例6: TestCCMLib
# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import set_log_level [as 别名]
class TestCCMLib(ccmtest.Tester):
def simple_test(self, version='2.0.9'):
self.cluster = Cluster(CLUSTER_PATH, "simple", cassandra_version=version)
self.cluster.populate(3)
self.cluster.start()
node1, node2, node3 = self.cluster.nodelist()
if version < '2.1':
node1.stress()
else:
node1.stress(['write', 'n=1000000'])
self.cluster.flush()
def simple_test_across_versions(self):
self.simple_test(version='1.2.18')
self.cluster.remove()
self.simple_test(version='2.0.9')
self.cluster.remove()
self.simple_test(version='2.1.0-rc5')
def restart_test(self):
self.cluster = Cluster(CLUSTER_PATH, "restart", cassandra_version='2.0.9')
self.cluster.populate(3)
self.cluster.start()
self.cluster.stop()
self.cluster.start()
self.cluster.show(True)
def multi_dc_test(self):
self.cluster = Cluster(CLUSTER_PATH, "multi_dc", cassandra_version='2.0.9')
self.cluster.populate([1, 2])
self.cluster.start()
dcs = [node.data_center for node in self.cluster.nodelist()]
self.cluster.set_configuration_options(None, None)
self.cluster.stop()
self.cluster.start()
dcs_2 = [node.data_center for node in self.cluster.nodelist()]
self.assertListEqual(dcs, dcs_2)
def test1(self):
self.cluster = Cluster(CLUSTER_PATH, "test1", cassandra_version='2.0.3')
self.cluster.show(False)
self.cluster.populate(2)
self.cluster.set_partitioner("Murmur3")
self.cluster.start()
self.cluster.set_configuration_options(None, None)
self.cluster.set_configuration_options({}, True)
self.cluster.set_configuration_options({"a": "b"}, False)
[node1, node2] = self.cluster.nodelist()
node2.compact()
self.cluster.flush()
self.cluster.stop()
def test2(self):
self.cluster = Cluster(CLUSTER_PATH, "test2", cassandra_version='2.0.3')
self.cluster.populate(2)
self.cluster.start()
self.cluster.set_log_level("ERROR")
class FakeNode:
name = "non-existing node"
self.cluster.remove(FakeNode())
[node1, node2] = self.cluster.nodelist()
self.cluster.remove(node1)
self.cluster.show(True)
self.cluster.show(False)
#self.cluster.stress([])
self.cluster.compact()
self.cluster.drain()
self.cluster.stop()
def test3(self):
self.cluster = Cluster(CLUSTER_PATH, "test3", cassandra_version='2.0.3')
self.cluster.populate(2)
self.cluster.start()
self.cluster.cleanup()
self.cluster.clear()
self.cluster.stop()