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


Python RemoteHelper.stop_bandwidth_monitor方法代码示例

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


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

示例1: CbAgent

# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import stop_bandwidth_monitor [as 别名]

#.........这里部分代码省略.........
            self.collectors.append(XdcrLag(settings))

    def prepare_latency(self, clusters, test):
        for cluster in clusters:
            settings = copy(self.settings)
            settings.interval = self.lat_interval
            settings.cluster = cluster
            settings.master_node = self.clusters[cluster]
            prefix = test.target_iterator.prefix or target_hash(settings.master_node.split(":")[0])
            self.collectors.append(SpringLatency(settings, test.workload, prefix))

    def prepare_subdoc_latency(self, clusters, test):
        for cluster in clusters:
            settings = copy(self.settings)
            settings.interval = self.lat_interval
            settings.cluster = cluster
            settings.master_node = self.clusters[cluster]
            prefix = test.target_iterator.prefix or target_hash(settings.master_node.split(":")[0])
            self.collectors.append(SpringSubdocLatency(settings, test.workload, prefix))

    def prepare_query_latency(self, clusters, test):
        params = test.test_config.index_settings.params
        index_type = test.test_config.index_settings.index_type
        for cluster in clusters:
            settings = copy(self.settings)
            settings.interval = self.lat_interval
            settings.cluster = cluster
            settings.master_node = self.clusters[cluster]
            prefix = test.target_iterator.prefix or target_hash(settings.master_node.split(":")[0])
            self.collectors.append(
                SpringQueryLatency(
                    settings, test.workload, prefix=prefix, ddocs=test.ddocs, params=params, index_type=index_type
                )
            )

    def prepare_spatial_latency(self, clusters, test):
        for cluster in clusters:
            settings = copy(self.settings)
            settings.interval = self.lat_interval
            settings.cluster = cluster
            settings.master_node = self.clusters[cluster]
            prefix = test.target_iterator.prefix or target_hash(settings.master_node.split(":")[0])
            self.collectors.append(
                SpringSpatialQueryLatency(
                    settings, test.workload, prefix=prefix, spatial_settings=test.test_config.spatial_settings
                )
            )

    def prepare_n1ql_latency(self, clusters, test):
        default_queries = test.test_config.access_settings.n1ql_queries
        self.settings.new_n1ql_queries = getattr(test, "n1ql_queries", default_queries)
        for cluster in clusters:
            settings = copy(self.settings)
            settings.interval = self.lat_interval
            settings.cluster = cluster
            settings.master_node = self.clusters[cluster]
            self.collectors.append(SpringN1QLQueryLatency(settings, test.workload, prefix="n1ql"))

    def prepare_active_tasks(self, clusters):
        for cluster in clusters:
            settings = copy(self.settings)
            settings.cluster = cluster
            settings.master_node = self.clusters[cluster]
            collector = ActiveTasks(settings)
            try:
                sum(1 for _ in collector.get_buckets())
                self.collectors.append(collector)
            except RuntimeError:
                pass

    def update_metadata(self):
        for collector in self.collectors:
            collector.update_metadata()

    def start(self):
        if self.bandwidth:
            self.remote.start_bandwidth_monitor()
        self.processes = [Process(target=c.collect) for c in self.collectors]
        map(lambda p: p.start(), self.processes)

    def stop(self):
        map(lambda p: p.terminate(), self.processes)
        if self.bandwidth:
            self.remote.stop_bandwidth_monitor()
        return datetime.utcnow()

    def trigger_reports(self, snapshot):
        for report_type in ("html", "get_corr_matrix"):
            url = "http://{}/reports/{}/?snapshot={}".format(self.settings.cbmonitor_host_port, report_type, snapshot)
            logger.info(url)
            requests.get(url=url)

    def add_snapshot(self, phase, ts_from, ts_to):
        for i, cluster in enumerate(self.clusters, start=1):
            snapshot = "{}_{}".format(cluster, phase)
            self.settings.cluster = cluster
            md_client = MetadataClient(self.settings)
            md_client.add_snapshot(snapshot, ts_from, ts_to)
            self.snapshots.append(snapshot)
            self.trigger_reports(snapshot)
开发者ID:sandipnd,项目名称:perfrunner,代码行数:104,代码来源:cbmonitor.py


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