Skip to content

Commit fc6fe15

Browse files
Storing ann benchmark artifacts (website and results) into s3. Agnostic client artifacts table (#311)
1 parent 587230f commit fc6fe15

File tree

4 files changed

+115
-36
lines changed

4 files changed

+115
-36
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.7.10"
3+
version = "0.7.11"
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]>","Redis Performance Group <[email protected]>"]
66
readme = "README.md"

redisbench_admin/run_remote/remote_client.py

Lines changed: 75 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
)
1818
from redisbench_admin.utils.benchmark_config import extract_benchmark_tool_settings
1919
from redisbench_admin.utils.redisgraph_benchmark_go import (
20-
setup_remote_benchmark_ann,
2120
get_redisbench_admin_remote_path,
2221
)
2322
from redisbench_admin.utils.remote import (
@@ -59,6 +58,8 @@ def run_remote_client_tool(
5958
_,
6059
) = extract_benchmark_tool_settings(benchmark_config, config_key)
6160
benchmark_tools_sanity_check(allowed_tools, benchmark_tool)
61+
local_output_artifacts = []
62+
remote_output_artifacts = []
6263
# setup the benchmark tool
6364
remote_tool_pre_bench_step(
6465
benchmark_config,
@@ -104,18 +105,20 @@ def run_remote_client_tool(
104105
tmp = local_bench_fname
105106
local_bench_fname = "result.csv"
106107
commands = [command_str]
107-
local_output_artifacts = []
108-
remote_output_artifacts = []
109108
if "ann" in benchmark_tool:
110-
[recv_exit_status, stdout, stderr] = get_redisbench_admin_remote_path(
111-
client_public_ip, username, private_key, client_ssh_port
112-
)[0]
113-
pkg_path = stdout[0].strip()
109+
pkg_path = get_ann_remote_pkg_path(
110+
client_public_ip, client_ssh_port, private_key, username
111+
)
114112
benchmark_suffix = local_bench_fname[: len(local_bench_fname) - 5]
115113
create_website_path = pkg_path + "/run/ann/pkg/"
116114
logging.info("Remote create website path: {}".format(create_website_path))
117115
website_outputdir = "/tmp/website-{}".format(benchmark_suffix)
118116
website_outputdir_zip = "/tmp/website-{}.zip".format(benchmark_suffix)
117+
website_outputdir_zip_local = "website-{}.zip".format(benchmark_suffix)
118+
results_outputdir = pkg_path + "/run/ann/pkg/results"
119+
results_outputdir_zip = "/tmp/results-{}.zip".format(benchmark_suffix)
120+
results_outputdir_zip_local = "results-{}.zip".format(benchmark_suffix)
121+
119122
mkdir_command = "mkdir -p {}".format(website_outputdir)
120123
create_website_command = (
121124
"cd {} && sudo python3 create_website.py --outputdir {}".format(
@@ -125,11 +128,19 @@ def run_remote_client_tool(
125128
zip_website_command = "zip -r {} {}".format(
126129
website_outputdir_zip, website_outputdir
127130
)
131+
132+
zip_results_command = "zip -r {} {}".format(
133+
results_outputdir_zip, results_outputdir
134+
)
128135
commands.append(mkdir_command)
129136
commands.append(create_website_command)
130137
commands.append(zip_website_command)
131-
local_output_artifacts.append(website_outputdir_zip)
138+
commands.append(zip_results_command)
139+
140+
local_output_artifacts.append(website_outputdir_zip_local)
141+
local_output_artifacts.append(results_outputdir_zip_local)
132142
remote_output_artifacts.append(website_outputdir_zip)
143+
remote_output_artifacts.append(results_outputdir_zip)
133144

134145
benchmark_start_time = datetime.datetime.now()
135146
# run the benchmark
@@ -176,16 +187,72 @@ def run_remote_client_tool(
176187
)[0]
177188
logging.warning("Remote results file content: {}".format(stdout))
178189

190+
final_local_output_artifacts = []
191+
if len(remote_output_artifacts) > 0:
192+
logging.info(
193+
"Retrieving a total of {} remote client artifacts".format(
194+
len(remote_output_artifacts)
195+
)
196+
)
197+
for client_artifact_n, client_remote_artifact in enumerate(remote_output_artifacts):
198+
client_local_artifact = local_output_artifacts[client_artifact_n]
199+
logging.info(
200+
"Retrieving remote client artifact: {} into local file {}".format(
201+
client_remote_artifact, client_local_artifact
202+
)
203+
)
204+
fetch_file_from_remote_setup(
205+
client_public_ip,
206+
username,
207+
private_key,
208+
client_local_artifact,
209+
client_remote_artifact,
210+
)
211+
final_local_output_artifacts.append(client_local_artifact)
212+
179213
return (
180214
artifact_version,
181215
benchmark_duration_seconds,
182216
local_bench_fname,
183217
remote_run_result,
184218
results_dict,
185219
return_code,
220+
final_local_output_artifacts,
186221
)
187222

188223

224+
def setup_remote_benchmark_ann(
225+
client_public_ip, username, private_key, client_ssh_port
226+
):
227+
commands = [
228+
"sudo apt install python3-pip -y",
229+
"sudo pip3 install redisbench-admin>=0.7.0",
230+
]
231+
# last argument (get_pty) needs to be set to true
232+
# check: https://stackoverflow.com/questions/5785353/paramiko-and-sudo
233+
execute_remote_commands(
234+
client_public_ip, username, private_key, commands, client_ssh_port, True
235+
)
236+
pkg_path = get_ann_remote_pkg_path(
237+
client_public_ip, client_ssh_port, private_key, username
238+
)
239+
logging.info("ensuring there is a clean results folder on ann-benchmarks pkg")
240+
commands = [
241+
"sudo rm -rf {}/results/*".format(pkg_path),
242+
]
243+
execute_remote_commands(
244+
client_public_ip, username, private_key, commands, client_ssh_port, True
245+
)
246+
247+
248+
def get_ann_remote_pkg_path(client_public_ip, client_ssh_port, private_key, username):
249+
[recv_exit_status, stdout, stderr] = get_redisbench_admin_remote_path(
250+
client_public_ip, username, private_key, client_ssh_port
251+
)[0]
252+
pkg_path = stdout[0].strip()
253+
return pkg_path
254+
255+
189256
def run_remote_benchmark(
190257
client_public_ip,
191258
username,

redisbench_admin/run_remote/run_remote.py

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ def run_remote_command_logic(args, project_name, project_version):
250250
)
251251
)
252252
if "remote" in benchmark_config:
253+
client_artifacts = []
254+
client_artifacts_map = {}
253255
temporary_dir = get_tmp_folder_rnd()
254256
(
255257
client_public_ip,
@@ -451,6 +453,7 @@ def run_remote_command_logic(args, project_name, project_version):
451453
remote_run_result,
452454
results_dict,
453455
return_code,
456+
client_output_artifacts,
454457
) = run_remote_client_tool(
455458
allowed_tools,
456459
artifact_version,
@@ -638,19 +641,6 @@ def run_remote_command_logic(args, project_name, project_version):
638641
)
639642
)
640643

641-
if args.upload_results_s3:
642-
logging.info(
643-
"Uploading results to s3. s3 bucket name: {}. s3 bucket path: {}".format(
644-
s3_bucket_name, s3_bucket_path
645-
)
646-
)
647-
artifacts = [local_bench_fname]
648-
upload_artifacts_to_s3(
649-
artifacts,
650-
s3_bucket_name,
651-
s3_bucket_path,
652-
)
653-
654644
(
655645
_,
656646
branch_target_tables,
@@ -732,6 +722,42 @@ def run_remote_command_logic(args, project_name, project_version):
732722
setup_name,
733723
test_name,
734724
)
725+
client_artifacts.append(local_bench_fname)
726+
client_artifacts.extend(client_output_artifacts)
727+
728+
if args.upload_results_s3:
729+
logging.info(
730+
"Uploading CLIENT results to s3. s3 bucket name: {}. s3 bucket path: {}".format(
731+
s3_bucket_name, s3_bucket_path
732+
)
733+
)
734+
client_artifacts_map = upload_artifacts_to_s3(
735+
client_artifacts,
736+
s3_bucket_name,
737+
s3_bucket_path,
738+
)
739+
740+
benchmark_artifacts_table_headers = [
741+
"Setup",
742+
"Test-case",
743+
"Artifact",
744+
"link",
745+
]
746+
for client_artifact in client_artifacts:
747+
client_artifact_link = "- n/a -"
748+
if client_artifact in client_artifacts_map:
749+
client_artifact_link = client_artifacts_map[
750+
client_artifact
751+
]
752+
benchmark_artifacts_links.append(
753+
[
754+
setup_name,
755+
test_name,
756+
client_artifact,
757+
" {} ".format(client_artifact_link),
758+
]
759+
)
760+
735761
except KeyboardInterrupt:
736762
logging.critical(
737763
"Detected Keyboard interruput...Destroy all remote envs and exiting right away!"

redisbench_admin/utils/redisgraph_benchmark_go.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@ def get_redisbench_admin_remote_path(
2222
)
2323

2424

25-
def setup_remote_benchmark_ann(
26-
client_public_ip, username, private_key, client_ssh_port
27-
):
28-
commands = [
29-
"sudo apt install python3-pip -y",
30-
"sudo pip3 install redisbench-admin>=0.7.0",
31-
]
32-
# last argument (get_pty) needs to be set to true
33-
# check: https://stackoverflow.com/questions/5785353/paramiko-and-sudo
34-
execute_remote_commands(
35-
client_public_ip, username, private_key, commands, client_ssh_port, True
36-
)
37-
38-
3925
def setup_remote_benchmark_agent(
4026
client_public_ip, username, private_key, client_ssh_port
4127
):

0 commit comments

Comments
 (0)