Skip to content

Commit 79d219a

Browse files
Enabled running ycsb on remote setups (#114)
* [add] enable running ycsb on remote setups * Bumping version from 0.1.79 to 0.1.80
1 parent f1999b6 commit 79d219a

File tree

6 files changed

+49
-13
lines changed

6 files changed

+49
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.1.79"
3+
version = "0.1.80"
44
description = "Redis benchmark run helper. A wrapper around Redis and Redis Modules benchmark tools ( ftsb_redisearch, memtier_benchmark, redis-benchmark, aibench, etc... )."
55
authors = ["filipecosta90 <[email protected]>"]
66
readme = "README.md"

redisbench_admin/run/common.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ def prepare_benchmark_parameters(
5858
)
5959

6060
if "ycsb" in benchmark_tool:
61+
if isremote is True:
62+
benchmark_tool = (
63+
"/tmp/ycsb-redisearch-binding-0.18.0-SNAPSHOT/bin/ycsb"
64+
)
65+
current_workdir = "/tmp/ycsb-redisearch-binding-0.18.0-SNAPSHOT"
6166
command_arr, command_str = prepare_ycsb_benchmark_command(
6267
benchmark_tool,
6368
server_private_ip,
@@ -122,14 +127,15 @@ def run_remote_benchmark(
122127
logging.info("remote process stdout: {}".format(stdout))
123128
logging.info("Extracting the benchmark results")
124129
remote_run_result = True
125-
fetch_file_from_remote_setup(
126-
client_public_ip,
127-
username,
128-
private_key,
129-
local_results_file,
130-
remote_results_file,
131-
)
132-
return remote_run_result
130+
if "ycsb" not in command:
131+
fetch_file_from_remote_setup(
132+
client_public_ip,
133+
username,
134+
private_key,
135+
local_results_file,
136+
remote_results_file,
137+
)
138+
return remote_run_result, stdout, stderr
133139

134140

135141
def common_exporter_logic(

redisbench_admin/run/ycsb/ycsb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ def post_process_ycsb_results(stdout, start_time_ms, start_time_str):
6969
}
7070
if type(stdout) == bytes:
7171
stdout = stdout.decode("ascii")
72-
csv_data = list(csv.reader(stdout.splitlines(), delimiter=","))
72+
if type(stdout) is not list:
73+
stdout = stdout.splitlines()
74+
csv_data = list(csv.reader(stdout, delimiter=","))
7375
start_row = 0
7476
for row in csv_data:
7577
if len(row) >= 1:

redisbench_admin/run_remote/run_remote.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from redisbench_admin.utils.redisgraph_benchmark_go import (
3131
spin_up_standalone_remote_redis,
3232
setup_remote_benchmark_tool_redisgraph_benchmark_go,
33+
setup_remote_benchmark_tool_ycsb_redisearch,
3334
)
3435
from redisbench_admin.utils.remote import (
3536
extract_git_vars,
@@ -396,6 +397,12 @@ def run_remote_command_logic(args):
396397
private_key,
397398
redisbenchmark_go_link,
398399
)
400+
if "ycsb" in benchmark_tool:
401+
setup_remote_benchmark_tool_ycsb_redisearch(
402+
client_public_ip,
403+
username,
404+
private_key,
405+
)
399406
if "tsbs_" in benchmark_tool:
400407
(
401408
queries_file_link,
@@ -456,7 +463,7 @@ def run_remote_command_logic(args):
456463
tmp = local_benchmark_output_filename
457464
local_benchmark_output_filename = "result.csv"
458465
# run the benchmark
459-
run_remote_benchmark(
466+
_, stdout, _ = run_remote_benchmark(
460467
client_public_ip,
461468
username,
462469
private_key,
@@ -465,11 +472,12 @@ def run_remote_command_logic(args):
465472
command_str,
466473
)
467474

468-
if benchmark_tool == "redis-benchmark" or benchmark_tool == "ycsb":
475+
if benchmark_tool == "redis-benchmark":
469476
local_benchmark_output_filename = tmp
470477
with open("result.csv", "r") as txt_file:
471478
stdout = txt_file.read()
472479

480+
if benchmark_tool == "redis-benchmark" or benchmark_tool == "ycsb":
473481
post_process_benchmark_results(
474482
benchmark_tool,
475483
local_benchmark_output_filename,
@@ -575,6 +583,10 @@ def run_remote_command_logic(args):
575583
traceback.print_exc(file=sys.stdout)
576584
print("-" * 60)
577585

586+
else:
587+
logging.info(
588+
"Test {} does not have remote config. Skipping test.".format(test_name)
589+
)
578590
for remote_setup_name, tf in remote_envs.items():
579591
# tear-down
580592
logging.info("Tearing down setup {}".format(remote_setup_name))

redisbench_admin/utils/redisgraph_benchmark_go.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,16 @@ def setup_remote_benchmark_tool_redisgraph_benchmark_go(
6666
"chmod 755 /tmp/redisgraph-benchmark-go",
6767
]
6868
execute_remote_commands(client_public_ip, username, private_key, commands)
69+
70+
71+
def setup_remote_benchmark_tool_ycsb_redisearch(
72+
client_public_ip,
73+
username,
74+
private_key,
75+
tool_link="https://s3.amazonaws.com/benchmarks.redislabs/redisearch/ycsb/ycsb-redisearch-binding-0.18.0-SNAPSHOT.tar.gz",
76+
):
77+
commands = [
78+
"wget {} -q -O /tmp/ycsb.tar.gz".format(tool_link),
79+
"tar -xvf /tmp/ycsb.tar.gz -C /tmp",
80+
]
81+
execute_remote_commands(client_public_ip, username, private_key, commands)

redisbench_admin/utils/results.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ def post_process_benchmark_results(
7777
local_benchmark_output_filename
7878
)
7979
)
80+
ycsb_input = stdout
81+
if type(ycsb_input) == bytes:
82+
ycsb_input = ycsb_input.decode("ascii")
8083
results_dict = post_process_ycsb_results(
81-
stdout.decode("ascii"),
84+
ycsb_input,
8285
start_time_ms,
8386
start_time_str,
8487
)

0 commit comments

Comments
 (0)