From 2ba2316a8198906e38b2be29efdc7637428ddca6 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Thu, 3 Jun 2021 01:26:01 +0100 Subject: [PATCH 1/2] [add] enable running ycsb on remote setups --- redisbench_admin/run/common.py | 22 ++++++++++++------- redisbench_admin/run/ycsb/ycsb.py | 4 +++- redisbench_admin/run_remote/run_remote.py | 16 ++++++++++++-- .../utils/redisgraph_benchmark_go.py | 13 +++++++++++ redisbench_admin/utils/results.py | 5 ++++- 5 files changed, 48 insertions(+), 12 deletions(-) diff --git a/redisbench_admin/run/common.py b/redisbench_admin/run/common.py index d48fb50..5929084 100644 --- a/redisbench_admin/run/common.py +++ b/redisbench_admin/run/common.py @@ -58,6 +58,11 @@ def prepare_benchmark_parameters( ) if "ycsb" in benchmark_tool: + if isremote is True: + benchmark_tool = ( + "/tmp/ycsb-redisearch-binding-0.18.0-SNAPSHOT/bin/ycsb" + ) + current_workdir = "/tmp/ycsb-redisearch-binding-0.18.0-SNAPSHOT" command_arr, command_str = prepare_ycsb_benchmark_command( benchmark_tool, server_private_ip, @@ -122,14 +127,15 @@ def run_remote_benchmark( logging.info("remote process stdout: {}".format(stdout)) logging.info("Extracting the benchmark results") remote_run_result = True - fetch_file_from_remote_setup( - client_public_ip, - username, - private_key, - local_results_file, - remote_results_file, - ) - return remote_run_result + if "ycsb" not in command: + fetch_file_from_remote_setup( + client_public_ip, + username, + private_key, + local_results_file, + remote_results_file, + ) + return remote_run_result, stdout, stderr def common_exporter_logic( diff --git a/redisbench_admin/run/ycsb/ycsb.py b/redisbench_admin/run/ycsb/ycsb.py index a1a2442..3d115a7 100644 --- a/redisbench_admin/run/ycsb/ycsb.py +++ b/redisbench_admin/run/ycsb/ycsb.py @@ -69,7 +69,9 @@ def post_process_ycsb_results(stdout, start_time_ms, start_time_str): } if type(stdout) == bytes: stdout = stdout.decode("ascii") - csv_data = list(csv.reader(stdout.splitlines(), delimiter=",")) + if type(stdout) is not list: + stdout = stdout.splitlines() + csv_data = list(csv.reader(stdout, delimiter=",")) start_row = 0 for row in csv_data: if len(row) >= 1: diff --git a/redisbench_admin/run_remote/run_remote.py b/redisbench_admin/run_remote/run_remote.py index c44c09c..3649c11 100644 --- a/redisbench_admin/run_remote/run_remote.py +++ b/redisbench_admin/run_remote/run_remote.py @@ -30,6 +30,7 @@ from redisbench_admin.utils.redisgraph_benchmark_go import ( spin_up_standalone_remote_redis, setup_remote_benchmark_tool_redisgraph_benchmark_go, + setup_remote_benchmark_tool_ycsb_redisearch, ) from redisbench_admin.utils.remote import ( extract_git_vars, @@ -396,6 +397,12 @@ def run_remote_command_logic(args): private_key, redisbenchmark_go_link, ) + if "ycsb" in benchmark_tool: + setup_remote_benchmark_tool_ycsb_redisearch( + client_public_ip, + username, + private_key, + ) if "tsbs_" in benchmark_tool: ( queries_file_link, @@ -456,7 +463,7 @@ def run_remote_command_logic(args): tmp = local_benchmark_output_filename local_benchmark_output_filename = "result.csv" # run the benchmark - run_remote_benchmark( + _, stdout, _ = run_remote_benchmark( client_public_ip, username, private_key, @@ -465,11 +472,12 @@ def run_remote_command_logic(args): command_str, ) - if benchmark_tool == "redis-benchmark" or benchmark_tool == "ycsb": + if benchmark_tool == "redis-benchmark": local_benchmark_output_filename = tmp with open("result.csv", "r") as txt_file: stdout = txt_file.read() + if benchmark_tool == "redis-benchmark" or benchmark_tool == "ycsb": post_process_benchmark_results( benchmark_tool, local_benchmark_output_filename, @@ -575,6 +583,10 @@ def run_remote_command_logic(args): traceback.print_exc(file=sys.stdout) print("-" * 60) + else: + logging.info( + "Test {} does not have remote config. Skipping test.".format(test_name) + ) for remote_setup_name, tf in remote_envs.items(): # tear-down logging.info("Tearing down setup {}".format(remote_setup_name)) diff --git a/redisbench_admin/utils/redisgraph_benchmark_go.py b/redisbench_admin/utils/redisgraph_benchmark_go.py index 9141bd7..ebe7885 100644 --- a/redisbench_admin/utils/redisgraph_benchmark_go.py +++ b/redisbench_admin/utils/redisgraph_benchmark_go.py @@ -66,3 +66,16 @@ def setup_remote_benchmark_tool_redisgraph_benchmark_go( "chmod 755 /tmp/redisgraph-benchmark-go", ] execute_remote_commands(client_public_ip, username, private_key, commands) + + +def setup_remote_benchmark_tool_ycsb_redisearch( + client_public_ip, + username, + private_key, + tool_link="https://s3.amazonaws.com/benchmarks.redislabs/redisearch/ycsb/ycsb-redisearch-binding-0.18.0-SNAPSHOT.tar.gz", +): + commands = [ + "wget {} -q -O /tmp/ycsb.tar.gz".format(tool_link), + "tar -xvf /tmp/ycsb.tar.gz -C /tmp", + ] + execute_remote_commands(client_public_ip, username, private_key, commands) diff --git a/redisbench_admin/utils/results.py b/redisbench_admin/utils/results.py index faf2c66..b105c1c 100644 --- a/redisbench_admin/utils/results.py +++ b/redisbench_admin/utils/results.py @@ -77,8 +77,11 @@ def post_process_benchmark_results( local_benchmark_output_filename ) ) + ycsb_input = stdout + if type(ycsb_input) == bytes: + ycsb_input = ycsb_input.decode("ascii") results_dict = post_process_ycsb_results( - stdout.decode("ascii"), + ycsb_input, start_time_ms, start_time_str, ) From 5cc09b7beded47cc1767efcdab9e84a97ece14b8 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Thu, 3 Jun 2021 01:27:39 +0100 Subject: [PATCH 2/2] Bumping version from 0.1.79 to 0.1.80 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6c13867..fbdcd73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "redisbench-admin" -version = "0.1.79" +version = "0.1.80" description = "Redis benchmark run helper. A wrapper around Redis and Redis Modules benchmark tools ( ftsb_redisearch, memtier_benchmark, redis-benchmark, aibench, etc... )." authors = ["filipecosta90 "] readme = "README.md"