本文整理汇总了Python中perfrunner.helpers.remote.RemoteHelper.install_package_gl方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteHelper.install_package_gl方法的具体用法?Python RemoteHelper.install_package_gl怎么用?Python RemoteHelper.install_package_gl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类perfrunner.helpers.remote.RemoteHelper
的用法示例。
在下文中一共展示了RemoteHelper.install_package_gl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GatewayInstaller
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import install_package_gl [as 别名]
class GatewayInstaller(object):
CBFS = 'http://cbfs-ext.hq.couchbase.com/builds/'
def __init__(self, cluster_spec, test_config, options):
self.remote_helper = RemoteHelper(cluster_spec)
self.cluster_spec = cluster_spec
self.test_config = test_config
self.pkg = self.remote_helper.detect_pkg()
self.version = options.version
def find_package(self):
filename = 'couchbase-sync-gateway_{}_x86_64.rpm'.format(self.version)
url = '{}{}'.format(self.CBFS, filename)
try:
status_code = requests.head(url).status_code
except requests.exceptions.ConnectionError:
pass
else:
if status_code == 200:
logger.info('Found "{}"'.format(url))
return filename, url
logger.interrupt('Target build not found - {}'.format(url))
def kill_processes_gw(self):
self.remote_helper.kill_processes_gw()
def kill_processes_gl(self):
self.remote_helper.kill_processes_gl()
def uninstall_package_gw(self):
filename, url = self.find_package()
self.remote_helper.uninstall_package_gw(self.pkg, filename)
def uninstall_package_gl(self):
self.remote_helper.uninstall_package_gl()
def install_package_gw(self):
filename, url = self.find_package()
self.remote_helper.install_package_gw(self.pkg, url, filename,
self.version)
def install_package_gl(self):
self.remote_helper.install_package_gl()
def start_sync_gateways(self):
with open('templates/gateway_config_template.json') as fh:
template = json.load(fh)
db_master = self.cluster_spec.yield_masters().next()
template['databases']['db']['server'] = "http://bucket-1:[email protected]{}/".format(db_master)
template['maxIncomingConnections'] = self.test_config.gateway_settings.conn_in
template['maxCouchbaseConnections'] = self.test_config.gateway_settings.conn_db
template['CompressResponses'] = self.test_config.gateway_settings.compression
with open('templates/gateway_config.json', 'w') as fh:
fh.write(pretty_dict(template))
self.remote_helper.start_sync_gateway()
def install(self):
num_gateways = len(self.cluster_spec.gateways)
num_gateloads = len(self.cluster_spec.gateloads)
if num_gateways != num_gateloads:
logger.interrupt(
'The cluster config file has different number of gateways({}) and gateloads({})'
.format(num_gateways, num_gateloads)
)
self.kill_processes_gw()
self.uninstall_package_gw()
self.install_package_gw()
self.start_sync_gateways()
self.kill_processes_gl()
self.uninstall_package_gl()
self.install_package_gl()