本文整理汇总了Python中perfrunner.helpers.remote.RemoteHelper.reset_memory_settings方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteHelper.reset_memory_settings方法的具体用法?Python RemoteHelper.reset_memory_settings怎么用?Python RemoteHelper.reset_memory_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类perfrunner.helpers.remote.RemoteHelper
的用法示例。
在下文中一共展示了RemoteHelper.reset_memory_settings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import reset_memory_settings [as 别名]
class PerfTest:
COLLECTORS = {}
ROOT_CERTIFICATE = 'root.pem'
def __init__(self,
cluster_spec: ClusterSpec,
test_config: TestConfig,
verbose: bool):
self.cluster_spec = cluster_spec
self.test_config = test_config
self.target_iterator = TargetIterator(cluster_spec, test_config)
self.cluster = ClusterManager(cluster_spec, test_config)
self.memcached = MemcachedHelper(test_config)
self.monitor = Monitor(cluster_spec, test_config, verbose)
self.rest = RestHelper(cluster_spec)
self.remote = RemoteHelper(cluster_spec, verbose)
self.profiler = Profiler(cluster_spec, test_config)
self.master_node = next(cluster_spec.masters)
self.build = self.rest.get_version(self.master_node)
self.metrics = MetricHelper(self)
self.reporter = ShowFastReporter(cluster_spec, test_config, self.build)
self.cbmonitor_snapshots = []
self.cbmonitor_clusters = []
if self.test_config.test_case.use_workers:
self.worker_manager = WorkerManager(cluster_spec, test_config,
verbose)
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
failure = self.debug()
self.tear_down()
if exc_type == KeyboardInterrupt:
logger.warn('The test was interrupted')
return True
if failure:
logger.interrupt(failure)
@property
def query_nodes(self) -> List[str]:
return self.rest.get_active_nodes_by_role(self.master_node, 'n1ql')
@property
def index_nodes(self) -> List[str]:
return self.rest.get_active_nodes_by_role(self.master_node, 'index')
@property
def fts_nodes(self) -> List[str]:
return self.rest.get_active_nodes_by_role(self.master_node, 'fts')
@property
def analytics_nodes(self) -> List[str]:
return self.rest.get_active_nodes_by_role(self.master_node, 'cbas')
@property
def eventing_nodes(self) -> List[str]:
return self.rest.get_active_nodes_by_role(self.master_node, 'eventing')
def tear_down(self):
if self.test_config.test_case.use_workers:
self.worker_manager.download_celery_logs()
self.worker_manager.terminate()
if self.test_config.cluster.online_cores:
self.remote.enable_cpu()
if self.test_config.cluster.kernel_mem_limit:
self.collect_logs()
self.cluster.reset_memory_settings()
def collect_logs(self):
self.remote.collect_info()
for hostname in self.cluster_spec.servers:
for fname in glob.glob('{}/*.zip'.format(hostname)):
shutil.move(fname, '{}.zip'.format(hostname))
def reset_memory_settings(self):
if self.test_config.cluster.kernel_mem_limit:
for service in self.test_config.cluster.kernel_mem_limit_services:
for server in self.cluster_spec.servers_by_role(service):
self.remote.reset_memory_settings(host_string=server)
self.monitor.wait_for_servers()
def debug(self) -> str:
failure = self.check_core_dumps()
failure = self.check_rebalance() or failure
#.........这里部分代码省略.........
示例2: __init__
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import reset_memory_settings [as 别名]
#.........这里部分代码省略.........
'data_writer',
'fts_admin',
'fts_searcher',
'query_delete',
'query_insert',
'query_select',
'query_update',
'views_admin',
):
if role in existing_roles:
roles.append(role + '[{bucket}]')
return roles
def delete_rbac_users(self):
if not self.is_compatible(min_release='5.0'):
return
for master in self.cluster_spec.masters:
for bucket in self.test_config.buckets:
self.rest.delete_rbac_user(
host=master,
bucket=bucket
)
def add_rbac_users(self):
if not self.rest.supports_rbac(self.master_node):
logger.info('RBAC not supported - skipping adding RBAC users')
return
if self.rest.is_community(self.master_node):
roles = self.generate_ce_roles()
else:
roles = self.generate_ee_roles()
for master in self.cluster_spec.masters:
admin_user, admin_password = self.cluster_spec.rest_credentials
self.rest.add_rbac_user(
host=master,
user=admin_user,
password=admin_password,
roles=['admin'],
)
for bucket in self.test_config.buckets:
bucket_roles = [role.format(bucket=bucket) for role in roles]
bucket_roles.append("admin")
self.rest.add_rbac_user(
host=master,
user=bucket, # Backward compatibility
password=self.test_config.bucket.password,
roles=bucket_roles,
)
def throttle_cpu(self):
if self.remote.os == 'Cygwin':
return
self.remote.enable_cpu()
if self.test_config.cluster.online_cores:
self.remote.disable_cpu(self.test_config.cluster.online_cores)
def tune_memory_settings(self):
kernel_memory = self.test_config.cluster.kernel_mem_limit
if kernel_memory:
for service in self.test_config.cluster.kernel_mem_limit_services:
for server in self.cluster_spec.servers_by_role(service):
self.remote.tune_memory_settings(host_string=server,
size=kernel_memory)
self.monitor.wait_for_servers()
def reset_memory_settings(self):
for service in self.test_config.cluster.kernel_mem_limit_services:
for server in self.cluster_spec.servers_by_role(service):
self.remote.reset_memory_settings(host_string=server)
self.monitor.wait_for_servers()
def flush_iptables(self):
self.remote.flush_iptables()
def clear_login_history(self):
self.remote.clear_wtmp()
def disable_wan(self):
self.remote.disable_wan()
def enable_ipv6(self):
if self.test_config.cluster.ipv6:
self.remote.enable_ipv6()
def set_x509_certificates(self):
logger.info('Setting x509 settings')
if self.test_config.access_settings.ssl_mode == "auth":
self.remote.setup_x509()
for host in self.cluster_spec.servers:
self.rest.upload_cluster_certificate(host)
for host in self.cluster_spec.servers:
self.rest.reload_cluster_certificate(host)
self.rest.enable_certificate_auth(host)