forked from tgrabiec/osv-apps
-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathtester_with_ycsb.py
30 lines (25 loc) · 1.16 KB
/
tester_with_ycsb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sys
import os
import subprocess
success = False
print("Started YCSB redis test ...")
curr_dir = os.getcwd()
server_host = os.getenv('OSV_HOSTNAME')
ycsb_home = os.getenv('YCSB_HOME') #Home of the cloned http://github.com/brianfrankcooper/YCSB.git
if not ycsb_home or not os.path.exists(ycsb_home):
print("Please set YCSB_HOME env variable that points to the directory of the http://github.com/brianfrankcooper/YCSB.git project")
else:
try:
os.chdir(ycsb_home)
output = subprocess.check_output(['./bin/ycsb', 'load', 'redis', '-s', '-P', 'workloads/workloada',
'-p', 'redis.host=%s' % server_host, '-p', 'redis.port=6379'], stderr=subprocess.STDOUT).decode()
print(output)
output = subprocess.check_output(['./bin/ycsb', 'run', 'redis', '-s', '-P', 'workloads/workloada',
'-p', 'redis.host=%s' % server_host, '-p', 'redis.port=6379'], stderr=subprocess.STDOUT).decode()
print(output)
if '[UPDATE], Return=OK' in output:
success = True
except subprocess.CalledProcessError as err:
print(err.output)
finally:
os.chdir(curr_dir)