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


Python RestConnection.set_indexer_memoryQuota方法代码示例

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


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

示例1: test_oom_increase_mem_quota

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_indexer_memoryQuota [as 别名]
 def test_oom_increase_mem_quota(self):
     """
     1. Get OOM
     2. Drop Already existing indexes
     3. Verify if state of indexes is changed to ready
     :return:
     """
     self.assertTrue(self._push_indexer_off_the_cliff(), "OOM Can't be achieved")
     indexer_memQuota = self.get_indexer_mem_quota()
     log.info("Current Indexer Memory Quota is {}".format(indexer_memQuota))
     for cnt in range(5):
         indexer_memQuota += 200
         log.info("Increasing Indexer Memory Quota to {0}".format(indexer_memQuota))
         rest = RestConnection(self.oomServer)
         rest.set_indexer_memoryQuota(indexMemoryQuota=indexer_memQuota)
         self.sleep(120)
         indexer_oom = self._validate_indexer_status_oom()
         if not indexer_oom:
             log.info("Indexer out of OOM...")
             break
     self.assertFalse(self._validate_indexer_status_oom(), "Indexer still in OOM")
     self.sleep(120)
     self._verify_bucket_count_with_index_count(self.load_query_definitions)
     self.multi_query_using_index(buckets=self.buckets,
                 query_definitions=self.load_query_definitions)
开发者ID:chethanrao,项目名称:testrunner-archive,代码行数:27,代码来源:memdb_oom_2i.py

示例2: test_change_mem_quota_when_index_building

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_indexer_memoryQuota [as 别名]
 def test_change_mem_quota_when_index_building(self):
     rest = RestConnection(self.oomServer)
     log.info("Setting indexer memory quota to 700 MB...")
     rest.set_indexer_memoryQuota(indexMemoryQuota=700)
     self.sleep(30)
     query_definitions = []
     for x in range(3):
         index_name = "index_"+str(x)
         query_definition = QueryDefinition(index_name=index_name, index_fields = ["job_title"],
                     query_template = self.query_template, groups = ["simple"])
         query_definitions.append(query_definition)
     create_tasks = []
     build_tasks = []
     index_info = {}
     for bucket in self.buckets:
         if not bucket in index_info.keys():
             index_info[bucket] = []
         for query_definition in query_definitions:
             index_info[bucket].append(query_definition.index_name)
             task = self.async_create_index(bucket.name, query_definition)
             create_tasks.append(task)
     for task in create_tasks:
         task.result()
     if self.defer_build:
         log.info("Building Indexes...")
         for key, val in index_info.iteritems():
             task = self.async_build_index(bucket=key, index_list=val)
             build_tasks.append(task)
     self.sleep(10)
     log.info("Setting indexer memory quota to 500 MB...")
     rest.set_indexer_memoryQuota(indexMemoryQuota=500)
     self.sleep(30)
     for task in build_tasks:
         task.result()
开发者ID:chethanrao,项目名称:testrunner-archive,代码行数:36,代码来源:memdb_oom_2i.py

示例3: setUp

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_indexer_memoryQuota [as 别名]
 def setUp(self):
     super(SecondaryIndexMemdbOomTests, self).setUp()
     self.indexMemQuota = self.input.param("indexMemQuota", 256)
     query_template = QUERY_TEMPLATE
     self.query_template = query_template.format("job_title")
     self.doc_ops = self.input.param("doc_ops", True)
     self.initial_index_number = self.input.param("initial_index_number", 2)
     self.oomServer = self.get_nodes_from_services_map(service_type="index")
     self.whereCondition= self.input.param("whereCondition"," job_title != \"Sales\" ")
     self.query_template += " WHERE {0}".format(self.whereCondition)
     rest = RestConnection(self.oomServer)
     if self.indexMemQuota > 256:
         log.info("Setting indexer memory quota to {0} MB...".format(self.indexMemQuota))
         rest.set_indexer_memoryQuota(indexMemoryQuota=self.indexMemQuota)
         self.sleep(30)
     self.deploy_node_info = ["{0}:{1}".format(self.oomServer.ip, self.oomServer.port)]
     self.load_query_definitions = []
     for x in range(self.initial_index_number):
         index_name = "index_name_"+str(x)
         query_definition = QueryDefinition(index_name=index_name, index_fields = ["job_title"],
                     query_template = self.query_template, groups = ["simple"])
         self.load_query_definitions.append(query_definition)
     self._initialize_multi_create_index(buckets = self.buckets,
                                        query_definitions = self.load_query_definitions,
                                        deploy_node_info=self.deploy_node_info)
     log.info("Setting indexer memory quota to 300 MB...")
     rest.set_indexer_memoryQuota(indexMemoryQuota=300)
     self.sleep(30)
开发者ID:chethanrao,项目名称:testrunner-archive,代码行数:30,代码来源:memdb_oom_2i.py

示例4: test_oom_reduce_mem_quota

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_indexer_memoryQuota [as 别名]
 def test_oom_reduce_mem_quota(self):
     """
     1. Build indexes without hitting OOM.
     2. Reduce memory quota of indexer.
     3. Check if indexer hits OOM
     :return:
     """
     indexer_memQuota = self.get_indexer_mem_quota()
     log.info("Current Indexer Memory Quota is {}".format(indexer_memQuota))
     used_memory = self.get_indexer_mem_quota()
     rest = RestConnection(self.oomServer)
     rest.set_indexer_memoryQuota(indexMemoryQuota=used_memory)
     self.sleep(60)
     self.assertTrue(self._validate_indexer_status_oom(), "Indexer is still Online")
开发者ID:chethanrao,项目名称:testrunner-archive,代码行数:16,代码来源:memdb_oom_2i.py

示例5: _bring_indexer_back_to_life

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_indexer_memoryQuota [as 别名]
 def _bring_indexer_back_to_life(self):
     """
     Private method to bring the indexer out of OOM.
     This is achieved by flushing a bucket
     :return:
     """
     rest = RestConnection(self.oomServer)
     log.info("Bringing Indexer out of OOM by dropping indexes.")
     for i in range(len(self.load_query_definitions)):
         for bucket in self.buckets:
             self.drop_index(bucket=bucket, query_definition=self.load_query_definitions[i])
             self.sleep(60)
         if not self._validate_indexer_status_oom():
             if i < len(self.load_query_definitions):
                 self.load_query_definitions = self.load_query_definitions[i+1:]
             else:
                 self.load_query_definitions = []
             break
     log.info("Setting indexer memory quota to 500 MB...")
     rest.set_indexer_memoryQuota(indexMemoryQuota=500)
     self.sleep(120)
     self.assertFalse(self._validate_indexer_status_oom(), "Indexer is still in OOM")
开发者ID:chethanrao,项目名称:testrunner-archive,代码行数:24,代码来源:memdb_oom_2i.py

示例6: initialize

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_indexer_memoryQuota [as 别名]
    def initialize(self, params):
        log.info('*****CouchbaseServerInstaller initialize the application ****')


        start_time = time.time()
        cluster_initialized = False
        server = params["server"]
        remote_client = RemoteMachineShellConnection(params["server"])
        while time.time() < start_time + 5 * 60:
            try:
                rest = RestConnection(server)

                # Optionally change node name and restart server
                if params.get('use_domain_names', 0):
                    RemoteUtilHelper.use_hostname_for_server_settings(server)

                # Make sure that data_path and index_path are writable by couchbase user
                for path in set(filter(None, [server.data_path, server.index_path])):
                    time.sleep(3)

                    for cmd in ("rm -rf {0}/*".format(path),
                                "chown -R couchbase:couchbase {0}".format(path)):
                        remote_client.execute_command(cmd)
                rest.set_data_path(data_path=server.data_path,
                                       index_path=server.index_path)
                time.sleep(3)

                # Initialize cluster
                if "init_nodes" in params:
                    init_nodes = params["init_nodes"]
                else:
                    init_nodes = "True"
                if (isinstance(init_nodes, bool) and init_nodes) or \
                        (isinstance(init_nodes, str) and init_nodes.lower() == "true"):
                    if not server.services:
                        set_services = ["kv"]
                    elif server.services:
                        set_services = server.services.split(',')

                    kv_quota = 0
                    while kv_quota == 0:
                        time.sleep(1)
                        kv_quota = int(rest.get_nodes_self().mcdMemoryReserved)
                    info = rest.get_nodes_self()
                    cb_version = info.version[:5]

                    if cb_version in COUCHBASE_FROM_VERSION_4:
                        if "index" in set_services and "fts" not in set_services:
                            log.info("quota for index service will be %s MB" \
                                                              % (INDEX_QUOTA))
                            kv_quota = int(info.mcdMemoryReserved * 2/3) - INDEX_QUOTA
                            log.info("set index quota to node %s " % server.ip)
                            rest.set_indexer_memoryQuota(indexMemoryQuota=INDEX_QUOTA)
                            if kv_quota < MIN_KV_QUOTA:
                                raise Exception("KV RAM needs to be more than %s MB"
                                        " at node  %s"  % (MIN_KV_QUOTA, server.ip))
                        elif "index" in set_services and "fts" in set_services:
                            log.info("quota for index service will be %s MB" \
                                                              % (INDEX_QUOTA))
                            log.info("quota for fts service will be %s MB" \
                                                                % (FTS_QUOTA))
                            kv_quota = int(info.mcdMemoryReserved * 2/3)\
                                                                 - INDEX_QUOTA \
                                                                 - FTS_QUOTA
                            log.info("set both index and fts quota at node %s "\
                                                                    % server.ip)
                            rest.set_indexer_memoryQuota(indexMemoryQuota=INDEX_QUOTA)
                            rest.set_fts_memoryQuota(ftsMemoryQuota=FTS_QUOTA)
                            if kv_quota < MIN_KV_QUOTA:
                                raise Exception("KV RAM need to be more than %s MB"
                                       " at node  %s"  % (MIN_KV_QUOTA, server.ip))
                        elif "fts" in set_services and "index" not in set_services:
                            log.info("quota for fts service will be %s MB" \
                                                                % (FTS_QUOTA))
                            kv_quota = int(info.mcdMemoryReserved * 2/3) - FTS_QUOTA
                            if kv_quota < MIN_KV_QUOTA:
                                raise Exception("KV RAM need to be more than %s MB"
                                       " at node  %s"  % (MIN_KV_QUOTA, server.ip))
                            """ for fts, we need to grep quota from ns_server
                                but need to make it works even RAM of vm is
                                smaller than 2 GB """
                            rest.set_fts_memoryQuota(ftsMemoryQuota=FTS_QUOTA)
                    """ set kv quota smaller than 1 MB so that it will satify
                        the condition smaller than allow quota """
                    kv_quota -= 1
                    log.info("quota for kv: %s MB" % kv_quota)
                    rest.init_cluster_memoryQuota(server.rest_username, \
                                                       server.rest_password, \
                                                                     kv_quota)
                    if params["version"][:5] in COUCHBASE_FROM_VERSION_4:
                        rest.init_node_services(username=server.rest_username,
                                                password=server.rest_password,
                                                        services=set_services)
                    rest.init_cluster(username=server.rest_username,
                                         password=server.rest_password)

                # Optionally disable consistency check
                if params.get('disable_consistency', 0):
                    rest.set_couchdb_option(section='couchdb',
                                            option='consistency_check_ratio',
#.........这里部分代码省略.........
开发者ID:EricACooper,项目名称:testrunner,代码行数:103,代码来源:install.py


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