本文整理汇总了Python中perfrunner.helpers.remote.RemoteHelper.clean_data方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteHelper.clean_data方法的具体用法?Python RemoteHelper.clean_data怎么用?Python RemoteHelper.clean_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类perfrunner.helpers.remote.RemoteHelper
的用法示例。
在下文中一共展示了RemoteHelper.clean_data方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CouchbaseInstaller
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import clean_data [as 别名]
class CouchbaseInstaller(object):
def __init__(self, cluster_spec, options):
self.options = options
self.remote = RemoteHelper(cluster_spec, None, options.verbose)
self.cluster_spec = cluster_spec
arch = self.remote.detect_arch()
pkg = self.remote.detect_pkg()
release = None
build = None
if options.version:
release, build = options.version.split('-')
self.build = Build(arch, pkg, options.cluster_edition, options.version,
release, build, options.url)
logger.info('Target build info: {}'.format(self.build))
def get_expected_filenames(self):
if self.build.pkg == 'rpm':
os_release = self.remote.detect_os_release()
patterns = (
'couchbase-server-{{edition}}-{{version}}-centos{}.{{arch}}.{{pkg}}'.format(os_release),
'couchbase-server-{edition}_centos6_{arch}_{version}-rel.{pkg}',
)
elif self.build.pkg == 'deb':
patterns = (
'couchbase-server-{edition}_{arch}_{version}-rel.{pkg}',
'couchbase-server-{edition}_{version}-ubuntu12.04_{arch}.{pkg}',
)
elif self.build.pkg == 'exe':
patterns = (
'couchbase-server-{edition}_{arch}_{version}-rel.setup.{pkg}',
'couchbase-server-{edition}_{version}-windows_{arch}.{pkg}',
'couchbase_server-{edition}-windows-{arch}-{version}.{pkg}',
)
else:
patterns = () # Sentinel
for pattern in patterns:
yield pattern.format(**self.build.__dict__)
@staticmethod
def is_exist(url):
try:
status_code = requests.head(url).status_code
except ConnectionError:
return False
if status_code == 200:
return True
return False
def find_package(self):
for filename in self.get_expected_filenames():
for location in LOCATIONS:
url = '{}{}'.format(location.format(**self.build.__dict__),
filename)
if self.is_exist(url):
return filename, url
logger.interrupt('Target build not found')
def kill_processes(self):
self.remote.kill_processes()
def uninstall_package(self):
self.remote.uninstall_couchbase(self.build.pkg)
def clean_data(self):
self.remote.clean_data()
def install_package(self):
if self.options.version:
filename, url = self.find_package()
else:
url = self.options.url
filename = urlparse(url).path.split('/')[-1]
logger.info('Using this URL: {}'.format(url))
self.remote.install_couchbase(self.build.pkg, url, filename,
self.build.release)
def install(self):
self.kill_processes()
self.uninstall_package()
self.clean_data()
self.install_package()
示例2: CouchbaseInstaller
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import clean_data [as 别名]
class CouchbaseInstaller(object):
CBFS = 'http://cbfs-ext.hq.couchbase.com/builds/'
LATEST_BUILDS = 'http://latestbuilds.hq.couchbase.com/'
SHERLOCK_BUILDS = ''
def __init__(self, cluster_spec, options):
self.remote = RemoteHelper(cluster_spec, None, options.verbose)
self.cluster_spec = cluster_spec
arch = self.remote.detect_arch()
pkg = self.remote.detect_pkg()
release, build = options.version.split('-')
self.SHERLOCK_BUILDS = 'http://latestbuilds.hq.couchbase.com/couchbase-server/sherlock/{}/'.format(build)
self.build = Build(arch, pkg, options.version, release, build,
options.toy)
logger.info('Target build info: {}'.format(self.build))
def get_expected_filenames(self):
patterns = () # Sentinel
if self.build.toy:
patterns = (
'couchbase-server-community_toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_toy-{toy}-{version}-toy_{arch}.{pkg}',
'couchbase-server-community_cent58-2.5.2-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent58-3.0.0-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent64-3.0.0-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent64-3.0.1-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent58-master-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent54-master-toy-{toy}-{arch}_{version}-toy.{pkg}',
)
elif self.build.pkg == 'rpm':
patterns = (
'couchbase-server-enterprise_centos6_{arch}_{version}-rel.{pkg}',
'couchbase-server-enterprise-{version}-centos6.{arch}.{pkg}',
'couchbase-server-enterprise_{arch}_{version}-rel.{pkg}',
)
elif self.build.pkg == 'deb':
patterns = (
'couchbase-server-enterprise_ubuntu_1204_{arch}_{version}-rel.{pkg}',
'couchbase-server-enterprise_{version}-ubuntu12.04_amd64.{pkg}',
'couchbase-server-enterprise_{arch}_{version}-rel.{pkg}',
)
elif self.build.pkg == 'exe':
patterns = (
'couchbase-server-enterprise_{arch}_{version}-rel.setup.{pkg}',
'couchbase_server-enterprise-windows-amd64-{version}.{pkg}',
'couchbase_server/{release}/{build}/couchbase_server-enterprise-windows-amd64-{version}.exe',
)
for pattern in patterns:
yield pattern.format(**self.build._asdict())
def find_package(self):
for filename in self.get_expected_filenames():
for base in (self.LATEST_BUILDS, self.SHERLOCK_BUILDS, self.CBFS):
url = '{}{}'.format(base, filename)
try:
status_code = requests.head(url).status_code
except ConnectionError:
continue
else:
if status_code == 200:
logger.info('Found "{}"'.format(url))
return filename, url
logger.interrupt('Target build not found')
def kill_processes(self):
self.remote.kill_processes()
def uninstall_package(self):
self.remote.uninstall_couchbase(self.build.pkg)
def clean_data(self):
self.remote.clean_data()
def install_package(self):
filename, url = self.find_package()
self.remote.install_couchbase(self.build.pkg, url, filename,
self.build.release)
def install(self):
self.kill_processes()
self.uninstall_package()
self.clean_data()
self.install_package()
示例3: __init__
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import clean_data [as 别名]
class CouchbaseInstaller:
def __init__(self, cluster_spec, options):
self.remote = RemoteHelper(cluster_spec, options.verbose)
self.options = options
@property
def url(self) -> str:
if validators.url(self.options.version):
return self.options.version
else:
return self.find_package(edition=self.options.edition)
@property
def release(self) -> str:
return self.options.version.split('-')[0]
@property
def build(self) -> str:
split = self.options.version.split('-')
if len(split) > 1:
return split[1]
def find_package(self, edition: str) -> [str, str]:
for url in self.url_iterator(edition):
if self.is_exist(url):
return url
logger.interrupt('Target build not found')
def url_iterator(self, edition: str) -> Iterator[str]:
os_release = None
if self.remote.package == 'rpm':
os_release = self.remote.detect_centos_release()
elif self.remote.package == 'deb':
os_release = self.remote.detect_ubuntu_release()
for pkg_pattern in PKG_PATTERNS[self.remote.package]:
for loc_pattern in LOCATIONS:
url = loc_pattern + pkg_pattern
yield url.format(release=self.release, build=self.build,
edition=edition, os=os_release)
@staticmethod
def is_exist(url):
try:
status_code = requests.head(url).status_code
except ConnectionError:
return False
if status_code == 200:
return True
return False
def download(self):
"""Download and save a copy of the specified package."""
if self.remote.package == 'rpm':
logger.info('Saving a local copy of {}'.format(self.url))
with open('couchbase.rpm', 'wb') as fh:
resp = requests.get(self.url)
fh.write(resp.content)
else:
logger.interrupt('Unsupported package format')
def kill_processes(self):
self.remote.kill_processes()
def uninstall_package(self):
self.remote.uninstall_couchbase()
def clean_data(self):
self.remote.clean_data()
def install_package(self):
logger.info('Using this URL: {}'.format(self.url))
self.remote.upload_iss_files(self.release)
self.remote.install_couchbase(self.url)
def install(self):
self.kill_processes()
self.uninstall_package()
self.clean_data()
self.install_package()
示例4: CouchbaseInstaller
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import clean_data [as 别名]
class CouchbaseInstaller(object):
CBFS = 'http://cbfs-ext.hq.couchbase.com/builds/'
LATEST_BUILDS = 'http://latestbuilds.hq.couchbase.com/'
SHERLOCK_BUILDS = ''
WATSON_BUILDS = ''
def __init__(self, cluster_spec, options):
self.options = options
self.remote = RemoteHelper(cluster_spec, None, options.verbose)
self.cluster_spec = cluster_spec
arch = self.remote.detect_arch()
pkg = self.remote.detect_pkg()
release = None
build = None
if options.version:
release, build = options.version.split('-')
self.SHERLOCK_BUILDS = 'http://latestbuilds.hq.couchbase.com/couchbase-server/sherlock/{}/'.format(build)
self.WATSON_BUILDS = 'http://172.23.120.24/builds/latestbuilds/couchbase-server/watson/{}/'.format(build)
if options.toy:
self.SHERLOCK_BUILDS = 'http://latestbuilds.hq.couchbase.com/couchbase-server/toy-{}/{}/'.format(options.toy, build)
self.build = Build(arch, pkg, options.cluster_edition, options.version,
release, build, options.toy, options.url)
logger.info('Target build info: {}'.format(self.build))
def get_expected_filenames(self):
patterns = () # Sentinel
if self.build.toy:
patterns = (
'couchbase-server-community_toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_toy-{toy}-{version}-toy_{arch}.{pkg}',
'couchbase-server-community_cent58-2.5.2-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent58-3.0.0-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_ubunt12-3.0.0-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent64-3.0.0-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent64-3.0.1-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent58-master-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent54-master-toy-{toy}-{arch}_{version}-toy.{pkg}',
# For toy builds >= Sherlock
'couchbase-server-{edition}-{version}-centos6.{arch}.{pkg}',
'couchbase-server-{edition}_{version}-ubuntu12.04_amd64.{pkg}',
)
elif self.build.pkg == 'rpm':
patterns = (
'couchbase-server-{edition}_centos6_{arch}_{version}-rel.{pkg}',
'couchbase-server-{edition}-{version}-centos6.{arch}.{pkg}',
'couchbase-server-{edition}_{arch}_{version}-rel.{pkg}',
'couchbase-server-{edition}-{version}.{arch}.{pkg}',
)
elif self.build.pkg == 'deb':
patterns = (
'couchbase-server-{edition}_ubuntu_1204_{arch}_{version}-rel.{pkg}',
'couchbase-server-{edition}_{version}-ubuntu12.04_amd64.{pkg}',
'couchbase-server-{edition}_{arch}_{version}-rel.{pkg}',
'couchbase-server-{edition}_{version}_amd64.{pkg}',
)
elif self.build.pkg == 'exe':
patterns = (
'couchbase-server-{edition}_{arch}_{version}-rel.setup.{pkg}',
'couchbase_server-{edition}-windows-amd64-{version}.{pkg}',
'couchbase-server-{edition}_{version}-windows_amd64.{pkg}',
'couchbase_server/{release}/{build}/couchbase_server-{edition}-windows-amd64-{version}.exe',
'couchbase-server-{edition}_{version}-windows_amd64.{pkg}',
)
for pattern in patterns:
yield pattern.format(**self.build._asdict())
def find_package(self):
for filename in self.get_expected_filenames():
for base in (self.LATEST_BUILDS, self.SHERLOCK_BUILDS, self.WATSON_BUILDS, self.CBFS):
url = '{}{}'.format(base, filename)
try:
status_code = requests.head(url).status_code
except ConnectionError:
continue
else:
if status_code == 200:
logger.info('Found "{}"'.format(url))
return filename, url
logger.interrupt('Target build not found')
def kill_processes(self):
self.remote.kill_processes()
def uninstall_package(self):
self.remote.uninstall_couchbase(self.build.pkg)
def clean_data(self):
self.remote.clean_data()
def install_package(self):
if not self.options.url:
filename, url = self.find_package()
else:
url = self.options.url
logger.info("Using this URL to install instead of searching amongst"
" the known locations: {}".format(url))
#.........这里部分代码省略.........
示例5: CouchbaseInstaller
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import clean_data [as 别名]
class CouchbaseInstaller(object):
CBFS = 'http://cbfs-ext.hq.couchbase.com/builds/'
LATEST_BUILDS = 'http://builds.hq.northscale.net/latestbuilds/'
def __init__(self, cluster_spec, options):
self.remote_helper = RemoteHelper(cluster_spec)
self.cluster_spec = cluster_spec
arch = self.remote_helper.detect_arch()
pkg = self.remote_helper.detect_pkg()
openssl = self.remote_helper.detect_openssl(pkg)
self.build = Build(arch, pkg, options.version, openssl, options.toy)
logger.info('Target build info: {}'.format(self.build))
def get_expected_filenames(self):
if self.build.toy:
patterns = (
'couchbase-server-community_toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_toy-{toy}-{version}-toy_{arch}.{pkg}',
'couchbase-server-community_cent58-2.5.2-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent58-3.0.0-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent58-master-toy-{toy}-{arch}_{version}-toy.{pkg}',
'couchbase-server-community_cent54-master-toy-{toy}-{arch}_{version}-toy.{pkg}',
)
elif self.build.openssl == '0.9.8e':
patterns = (
'couchbase-server-enterprise_{arch}_{version}-rel.{pkg}',
'couchbase-server-enterprise_{version}-rel_{arch}_openssl098.{pkg}',
)
else:
patterns = (
'couchbase-server-enterprise_centos6_{arch}_{version}-rel.{pkg}',
'couchbase-server-enterprise_{arch}_{version}-rel.{pkg}',
'couchbase-server-enterprise_{version}-rel_{arch}.{pkg}',
)
for pattern in patterns:
yield pattern.format(**self.build._asdict())
def find_package(self):
for filename in self.get_expected_filenames():
for base in (self.LATEST_BUILDS, self.CBFS):
url = '{}{}'.format(base, filename)
try:
status_code = requests.head(url).status_code
except requests.exceptions.ConnectionError:
continue
else:
if status_code == 200:
logger.info('Found "{}"'.format(url))
return filename, url
logger.interrupt('Target build not found')
def kill_processes(self):
self.remote_helper.kill_processes()
def uninstall_package(self):
self.remote_helper.uninstall_package(self.build.pkg)
def clean_data(self):
self.remote_helper.clean_data()
def install_package(self):
filename, url = self.find_package()
version = self.build.version.split('-')[0]
self.remote_helper.install_package(self.build.pkg, url, filename,
version)
def install(self):
self.kill_processes()
self.uninstall_package()
self.clean_data()
self.install_package()