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


Python RestConnection.diag_eval方法代码示例

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


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

示例1: PerfBase

# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import diag_eval [as 别名]

#.........这里部分代码省略.........
        for bucket in self.buckets:
            bucket_ram_quota = self.parami('mem_quota', PerfDefaults.mem_quota)
            bucket_ram_quota /= max(self.parami('num_buckets', 1),
                                    self.parami('xdcr_num_buckets', 1))
            replicas = self.parami('replicas', getattr(self, 'replicas', 1))
            index_replicas = self.parami('index_replicas', 1)

            self.rest.create_bucket(bucket=bucket, ramQuotaMB=bucket_ram_quota,
                                    replicaNumber=replicas, authType='sasl',
                                    replica_index=index_replicas)

            status = self.rest_helper.vbucket_map_ready(bucket, 60)
            self.assertTrue(status, msg='vbucket_map not ready .. timed out')
            status = self.rest_helper.bucket_exists(bucket)
            self.assertTrue(status,
                            msg='unable to create {0} bucket'.format(bucket))

    def reconfigure(self):
        """Customize basic Couchbase setup"""
        self.log.info("customizing setup")

        self.set_loglevel()
        self.customize_xdcr_settings()
        self.set_autocompaction()
        self.set_exp_pager_stime()
        self.set_rebalance_options()

    def set_rebalance_options(self):
        # rebalanceMovesBeforeCompaction
        rmbc = self.parami('rebalance_moves_before_compaction', 0)
        if rmbc:
            cmd = 'ns_config:set(rebalance_moves_before_compaction, {0}).'\
                .format(rmbc)
            self.rest.diag_eval(cmd)

    def set_exp_pager_stime(self):
        exp_pager_stime = self.param('exp_pager_stime',
                                     PerfDefaults.exp_pager_stime)
        if exp_pager_stime != PerfDefaults.exp_pager_stime:
            self.set_ep_param('flush_param', 'exp_pager_stime', exp_pager_stime)

    def set_loglevel(self):
        """Set custom loglevel"""

        loglevel = self.param('loglevel', None)
        if loglevel:
            self.rest.set_global_loglevel(loglevel)

    def set_mc_threads(self, node, mc_threads):
        """Change number of memcached threads"""
        rest = RestConnection(node)
        rest.set_mc_threads(mc_threads)
        self.log.info("num of memcached threads = {0}".format(mc_threads))

    def customize_xdcr_settings(self):
        """Set custom XDCR environment variables"""
        max_concurrent_reps_per_doc = self.param('max_concurrent_reps_per_doc',
                                                 None)
        xdcr_doc_batch_size_kb = self.param('xdcr_doc_batch_size_kb', None)
        xdcr_checkpoint_interval = self.param('xdcr_checkpoint_interval', None)

        if max_concurrent_reps_per_doc:
            env_var = 'MAX_CONCURRENT_REPS_PER_DOC'
            value = max_concurrent_reps_per_doc
        elif xdcr_doc_batch_size_kb:
            env_var = 'XDCR_DOC_BATCH_SIZE_KB'
开发者ID:,项目名称:,代码行数:70,代码来源:

示例2: test_view_rebalance

# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import diag_eval [as 别名]
    def test_view_rebalance(self):
        """Alk's specification.

        Cluster setup:
        -- 4 nodes
        -- 1 bucket
        -- 8GB total RAM
        -- 5GB bucket quota
        -- no data replica
        -- no index replica
        -- no view compaction

        All phases are enabled by default.
        Load phase:
        -- 10M items x 2KB average values size
        -- no expiration
        Index phase:
        -- 1 design ddoc, 1 view
        Access phase:
        -- no front-end workload
        -- rebalance out, from 4 to 3 nodes
        -- stale=false query after rebalance
        """
        # Legacy
        self.spec(self.__str__().split(" ")[0])

        # Disable stats
        self.input.test_params['stats'] = 0

        # View compaction setup
        rc = RestConnection(self.input.servers[0])
        vt = 30 if self.parami('view_compaction', 1) else 100
        rc.set_auto_compaction(dbFragmentThresholdPercentage=30,
                               viewFragmntThresholdPercentage=vt)

        # Consistent view setup
        if self.parami('consistent_view', 1):
            rc.set_reb_cons_view(disable=False)
        else:
            rc.set_reb_cons_view(disable=True)

        # rebalance_moves_per_second setup
        rmps = self.parami('rebalance_moves_per_second', 1)
        cmd = 'ns_config:set(rebalance_moves_per_node, {0}).'.format(rmps)
        rc.diag_eval(cmd)

        # index_pausing_disabled setup
        ipd = str(bool(self.parami('index_pausing_disabled', 0))).lower()
        cmd = 'ns_config:set(index_pausing_disabled, {0}).'.format(ipd)
        rc.diag_eval(cmd)

        # rebalance_index_waiting_disabled setup
        riwd = str(bool(self.parami('rebalance_index_waiting_disabled', 0))).lower()
        cmd = 'ns_config:set(rebalance_index_waiting_disabled, {0}).'.format(riwd)
        rc.diag_eval(cmd)

        # Customize number of design docs
        view_gen = ViewGen()
        if self.parami('ddocs', 1) == 1:
            ddocs = view_gen.generate_ddocs([1])
        elif self.parami('ddocs', 1) == 8:
            ddocs = view_gen.generate_ddocs([1, 1, 1, 1, 1, 1, 1, 1])
        else:
            sys.exit('Only 1 or 8 ddocs supported.')

        # Load phase
        if self.parami('load_phase', 1):
            num_nodes = self.parami('num_nodes', PerfDefaults.num_nodes)
            self.load_phase(num_nodes)

        # Index phase
        if self.parami('index_phase', 1):
            self.index_phase(ddocs)

        # Access phase
        if self.parami('access_phase', 1):
            if self.param('rebalance', 'out') == 'out':
                RebalanceHelper.rebalance_out(servers=self.input.servers,
                                              how_many=1, monitor=True)
            elif self.param('rebalance', 'out') == 'swap':
                RebalanceHelper.rebalance_swap(servers=self.input.servers,
                                               how_many=1, monitor=True)
            else:
                sys.exit('Only rebalance-out and swap rebalance supported.')
            self.measure_indexing_time(rc, ddocs)
开发者ID:mschoch,项目名称:testrunner,代码行数:87,代码来源:iperf.py


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