Skip to content

Commit 3b276da

Browse files
committed
update remote functions to support running ch2 on aws
Change-Id: I070e23f577be5ed2d82af34b82e381d785e46fc8 Reviewed-on: https://review.couchbase.org/c/perfrunner/+/169461 Tested-by: Build Bot <[email protected]> Reviewed-by: Korrigan Clark <[email protected]>
1 parent d62d8b0 commit 3b276da

File tree

2 files changed

+56
-10
lines changed

2 files changed

+56
-10
lines changed

perfrunner/remote/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,15 @@ def extract_cb(self, filename: str, worker_home: str):
150150
logger.info('extra couchbase.rpm')
151151
with cd(worker_home), cd('perfrunner'):
152152
run('rpm2cpio ./{} | cpio -idm'.format(filename))
153+
154+
@master_client
155+
def get_ch2_logfile(self, worker_home: str, logfile: str):
156+
logger.info('Collecting CH2 log')
157+
with cd(worker_home), cd('perfrunner'):
158+
r = run('stat {}*.log'.format(logfile), quiet=True)
159+
if not r.return_code:
160+
get('{}*.log'.format(logfile), local_path='./')
161+
162+
@master_client
163+
def init_ch2(self, repo: str, branch: str, worker_home: str):
164+
self.clone_git_repo(repo=repo, branch=branch, worker_home=worker_home)

perfrunner/remote/linux.py

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -798,28 +798,32 @@ def client_drop_caches(self):
798798

799799
@master_client
800800
def restore(self, master_node: str, cluster_spec: ClusterSpec, threads: int,
801-
worker_home: str, obj_staging_dir: str = None, obj_region: str = None,
802-
use_tls: bool = False):
803-
logger.info('Restore from {}'.format(cluster_spec.backup))
801+
worker_home: str, archive: str = '', repo: str = 'default',
802+
obj_staging_dir: str = None, obj_region: str = None,
803+
use_tls: bool = False, map_data: str = None):
804+
logger.info('Restore from {}'.format(archive))
804805

805806
self.cbbackupmgr_restore(master_node, cluster_spec, threads, worker_home,
806-
obj_staging_dir, obj_region, use_tls)
807+
archive, repo, obj_staging_dir, obj_region,
808+
use_tls, map_data)
807809

808810
@master_client
809811
def cbbackupmgr_restore(self, master_node: str, cluster_spec: ClusterSpec,
810-
threads: int, worker_home: str,
811-
obj_staging_dir: str = None, obj_region: str = None,
812-
use_tls: bool = False):
812+
threads: int, worker_home: str, archive: str = '',
813+
repo: str = 'default', obj_staging_dir: str = None,
814+
obj_region: str = None, use_tls: bool = False,
815+
map_data: str = None):
813816
with cd(worker_home), cd('perfrunner'):
814-
flags = ['--archive {}'.format(cluster_spec.backup),
815-
'--repo default',
817+
flags = ['--archive {}'.format(archive or cluster_spec.backup),
818+
'--repo {}'.format(repo),
816819
'--cluster http{}://{}'.format('s' if use_tls else '', master_node),
817820
'--cacert root.pem' if use_tls else None,
818821
'--username {}'.format(cluster_spec.rest_credentials[0]),
819822
'--password {}'.format(cluster_spec.rest_credentials[1]),
820823
'--threads {}'.format(threads) if threads else None,
821824
'--obj-region {}'.format(obj_region) if obj_region else None,
822-
'--obj-staging-dir {}'.format(obj_staging_dir) if obj_staging_dir else None]
825+
'--obj-staging-dir {}'.format(obj_staging_dir) if obj_staging_dir else None,
826+
'--map-data {}'.format(map_data) if map_data else None]
823827
cmd = './opt/couchbase/bin/cbbackupmgr restore --force-updates {}'.format(
824828
' '.join(filter(None, flags)))
825829

@@ -924,3 +928,33 @@ def copy_backup(self, backup_directory: str):
924928
def remove_data(self):
925929
logger.info('Clean up /data/')
926930
run('rm -rf /data/*')
931+
932+
@master_client
933+
def ch2_run_task(self, cluster_spec: ClusterSpec, worker_home: str, warehouses: int,
934+
aclients: int = 0, tclients: int = 0, duration: int = 0,
935+
iterations: int = 0, warmup_iterations: int = 0, warmup_duration: int = 0,
936+
query_url: str = None, multi_query_url: str = None,
937+
analytics_url: str = None, log_file: str = 'ch2_mixed'):
938+
939+
flags = ['--warehouses {}'.format(warehouses),
940+
'--aclients {}'.format(aclients) if aclients else None,
941+
'--tclients {}'.format(tclients) if tclients else None,
942+
'--duration {}'.format(duration) if duration else None,
943+
'--warmup-duration {}'.format(warmup_duration) if warmup_duration else None,
944+
'--query-iterations {}'.format(iterations) if iterations else None,
945+
'--warmup-query-iterations {}'.format(warmup_iterations)
946+
if warmup_iterations else None,
947+
'nestcollections',
948+
'--query-url {}'.format(query_url) if tclients else None,
949+
'--multi-query-url {}'.format(multi_query_url) if tclients else None,
950+
'--analytics-url {}'.format(analytics_url) if aclients else None,
951+
'--userid {}'.format(cluster_spec.rest_credentials[0]),
952+
'--password {}'.format(cluster_spec.rest_credentials[1]),
953+
'--no-load > ../../../{}.log'.format(log_file)]
954+
955+
cmd = '../../../env/bin/python3 ./tpcc.py {}'.format(
956+
' '.join(filter(None, flags)))
957+
958+
with cd(worker_home), cd('perfrunner'), cd('ch2/ch2driver/pytpcc/'):
959+
logger.info('Running: {}'.format(cmd))
960+
run(cmd)

0 commit comments

Comments
 (0)