Skip to content

Commit ede8335

Browse files
Updated ann-benchmark to the latest pkg version and extend tests on create_website.py (#336)
1 parent 4ee738f commit ede8335

File tree

4 files changed

+68
-23
lines changed

4 files changed

+68
-23
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.29"
3+
version = "0.7.35"
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/ann/pkg

Submodule pkg updated 1 file

redisbench_admin/run_remote/remote_client.py

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,27 +115,16 @@ def run_remote_client_tool(
115115
pkg_path = get_ann_remote_pkg_path(
116116
client_public_ip, client_ssh_port, private_key, username
117117
)
118-
benchmark_suffix = local_bench_fname[: len(local_bench_fname) - 5]
119-
create_website_path = pkg_path + "/run/ann/pkg/"
120-
logging.info("Remote create website path: {}".format(create_website_path))
121-
website_outputdir = "website-{}".format(benchmark_suffix)
122-
website_outputdir_zip = "/tmp/website-{}.zip".format(benchmark_suffix)
123-
website_outputdir_zip_local = "website-{}.zip".format(benchmark_suffix)
124-
results_outputdir = pkg_path + "/run/ann/pkg"
125-
results_outputdir_zip = "/tmp/results-{}.zip".format(benchmark_suffix)
126-
results_outputdir_zip_local = "results-{}.zip".format(benchmark_suffix)
127-
128-
mkdir_command = "mkdir -p /tmp/{}".format(website_outputdir)
129-
create_website_command = "cd {} && sudo python3 create_website.py --scatter --outputdir /tmp/{}".format(
130-
create_website_path, website_outputdir
131-
)
132-
zip_website_command = "cd /tmp && zip -r {} {}/*".format(
133-
website_outputdir_zip, website_outputdir
134-
)
135-
136-
zip_results_command = "cd {} && zip -r {} results/*".format(
137-
results_outputdir, results_outputdir_zip
138-
)
118+
(
119+
create_website_command,
120+
mkdir_command,
121+
results_outputdir_zip,
122+
results_outputdir_zip_local,
123+
website_outputdir_zip,
124+
website_outputdir_zip_local,
125+
zip_results_command,
126+
zip_website_command,
127+
) = ann_benchmark_remote_cmds(local_bench_fname, pkg_path)
139128
post_commands.append(mkdir_command)
140129
post_commands.append(create_website_command)
141130
post_commands.append(zip_website_command)
@@ -261,6 +250,40 @@ def run_remote_client_tool(
261250
)
262251

263252

253+
def ann_benchmark_remote_cmds(local_bench_fname, pkg_path):
254+
benchmark_suffix = local_bench_fname[: len(local_bench_fname) - 5]
255+
create_website_path = pkg_path + "/run/ann/pkg/"
256+
logging.info("Remote create website path: {}".format(create_website_path))
257+
website_outputdir = "website-{}".format(benchmark_suffix)
258+
website_outputdir_zip = "/tmp/website-{}.zip".format(benchmark_suffix)
259+
website_outputdir_zip_local = "website-{}.zip".format(benchmark_suffix)
260+
results_outputdir = pkg_path + "/run/ann/pkg"
261+
results_outputdir_zip = "/tmp/results-{}.zip".format(benchmark_suffix)
262+
results_outputdir_zip_local = "results-{}.zip".format(benchmark_suffix)
263+
mkdir_command = "mkdir -p /tmp/{}".format(website_outputdir)
264+
create_website_command = (
265+
"cd {} && sudo python3 create_website.py --scatter --outputdir /tmp/{}".format(
266+
create_website_path, website_outputdir
267+
)
268+
)
269+
zip_website_command = "cd /tmp && zip -r {} {}/*".format(
270+
website_outputdir_zip, website_outputdir
271+
)
272+
zip_results_command = "cd {} && zip -r {} results/*".format(
273+
results_outputdir, results_outputdir_zip
274+
)
275+
return (
276+
create_website_command,
277+
mkdir_command,
278+
results_outputdir_zip,
279+
results_outputdir_zip_local,
280+
website_outputdir_zip,
281+
website_outputdir_zip_local,
282+
zip_results_command,
283+
zip_website_command,
284+
)
285+
286+
264287
def setup_remote_benchmark_ann(
265288
client_public_ip, username, private_key, client_ssh_port
266289
):

tests/test_remote_client.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import yaml
77

88
from redisbench_admin.run.common import prepare_benchmark_parameters
9+
from redisbench_admin.run_remote.remote_client import ann_benchmark_remote_cmds
910
from redisbench_admin.utils.benchmark_config import extract_benchmark_tool_settings
1011

1112

@@ -46,3 +47,24 @@ def test_run_remote_benchmark():
4647
# port,
4748
# )
4849
# assert remote_run_result is False
50+
51+
52+
def test_ann_benchmark_remote_cmds():
53+
pkg_path = "/usr/local/lib/python3.6/dist-packages/redisbench_admin"
54+
local_bench_fname = "local-fname.log"
55+
(
56+
create_website_command,
57+
mkdir_command,
58+
results_outputdir_zip,
59+
results_outputdir_zip_local,
60+
website_outputdir_zip,
61+
website_outputdir_zip_local,
62+
zip_results_command,
63+
zip_website_command,
64+
) = ann_benchmark_remote_cmds(local_bench_fname, pkg_path)
65+
assert (
66+
create_website_command
67+
== "cd {}/run/ann/pkg/ && sudo python3 create_website.py --scatter --outputdir /tmp/website-local-fnam".format(
68+
pkg_path
69+
)
70+
)

0 commit comments

Comments
 (0)