当前位置: 首页>>代码示例>>Python>>正文


Python Cluster.version方法代码示例

本文整理汇总了Python中ccmlib.cluster.Cluster.version方法的典型用法代码示例。如果您正苦于以下问题:Python Cluster.version方法的具体用法?Python Cluster.version怎么用?Python Cluster.version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ccmlib.cluster.Cluster的用法示例。


在下文中一共展示了Cluster.version方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import version [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)
开发者ID:alanristic,项目名称:ccm,代码行数:36,代码来源:cluster_cmds.py

示例2: _get_cluster

# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import version [as 别名]
    def _get_cluster(self, name='test'):
        self.test_path = tempfile.mkdtemp(prefix='dtest-')
        # ccm on cygwin needs absolute path to directory - it crosses from cygwin space into
        # regular Windows space on wmic calls which will otherwise break pathing
        if sys.platform == "cygwin":
            self.test_path = subprocess.Popen(["cygpath", "-m", self.test_path], stdout = subprocess.PIPE, stderr = subprocess.STDOUT).communicate()[0].rstrip()
        debug("cluster ccm directory: "+self.test_path)
        version = os.environ.get('CASSANDRA_VERSION')
        cdir = os.environ.get('CASSANDRA_DIR', DEFAULT_DIR)
        
        if version:
            cluster = Cluster(self.test_path, name, cassandra_version=version)
        else:
            cluster = Cluster(self.test_path, name, cassandra_dir=cdir)
        
        if cluster.version() >= "1.2":
            if DISABLE_VNODES:
                cluster.set_configuration_options(values={'num_tokens': None})
            else:
                cluster.set_configuration_options(values={'initial_token': None, 'num_tokens': NUM_TOKENS})

        if cluster.version() >= "2.1":
            if OFFHEAP_MEMTABLES:
                cluster.set_configuration_options(values={'memtable_allocation_type': 'offheap_objects'})

        return cluster
开发者ID:pcmanus,项目名称:cassandra-dtest,代码行数:28,代码来源:dtest.py

示例3: run

# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import version [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)
开发者ID:PseudoCorps,项目名称:ccm,代码行数:50,代码来源:cluster_cmds.py

示例4: run

# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import version [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)
开发者ID:eevans,项目名称:ccm,代码行数:29,代码来源:cluster_cmds.py

示例5: _get_cluster

# 需要导入模块: from ccmlib.cluster import Cluster [as 别名]
# 或者: from ccmlib.cluster.Cluster import version [as 别名]
 def _get_cluster(self, name='test'):
     self.test_path = tempfile.mkdtemp(prefix='dtest-')
     # ccm on cygwin needs absolute path to directory - it crosses from cygwin space into
     # regular Windows space on wmic calls which will otherwise break pathing
     if sys.platform == "cygwin":
         self.test_path = subprocess.Popen(["cygpath", "-m", self.test_path], stdout = subprocess.PIPE, stderr = subprocess.STDOUT).communicate()[0].rstrip()
     debug("cluster ccm directory: "+self.test_path)
     try:
         version = os.environ['CASSANDRA_VERSION']
         cluster = Cluster(self.test_path, name, cassandra_version=version)
     except KeyError:
         try:
             cdir = os.environ['CASSANDRA_DIR']
         except KeyError:
             cdir = DEFAULT_DIR
         cluster = Cluster(self.test_path, name, cassandra_dir=cdir)
     if cluster.version() >= "1.2":
         if DISABLE_VNODES:
             cluster.set_configuration_options(values={'num_tokens': None})
         else:
             cluster.set_configuration_options(values={'initial_token': None, 'num_tokens': 256})
     return cluster
开发者ID:AlfredChenxf,项目名称:cassandra-dtest,代码行数:24,代码来源:dtest.py


注:本文中的ccmlib.cluster.Cluster.version方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。