Skip to content

Commit a1ecbdf

Browse files
Updated dependencies to match ann-benchmark deps (#299)
* Bumping version from 0.6.27 to 0.7.0 * Updated dependencies to match ann-benchmark deps * Bumping version from 0.7.0 to 0.7.1 * Bumping version from 0.7.0 to 0.7.1
1 parent 4ebfc8d commit a1ecbdf

File tree

9 files changed

+407
-91
lines changed

9 files changed

+407
-91
lines changed

poetry.lock

Lines changed: 297 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.7.0"
3+
version = "0.7.1"
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"
@@ -23,18 +23,26 @@ jsonpath_ng = "^1.5.2"
2323
pysftp = "^0.2.9"
2424
python_terraform = "^0.10.1"
2525
GitPython = "^3.1.12"
26-
PyYAML = "^5.4.0"
26+
PyYAML = "^5.4"
2727
wget = "^3.2"
2828
pytablewriter = {extras = ["html"], version = "^0.64.1"}
2929
sshtunnel = "^0.4.0"
3030
pyWorkFlow = "^0.0.2"
3131
Flask = "^2.0.1"
3232
flask-restx = "^0.5.1"
3333
Flask-HTTPAuth = "^4.4.0"
34-
docker = "^5.0.0"
34+
docker = "^5.0.2"
3535
tox-docker = "^3.1.0"
3636
daemonize = "^2.5.0"
3737
pandas = "^1.0"
38+
ansicolors = "^1.1.8"
39+
h5py = "^2.10.0"
40+
matplotlib = "^3.1.2"
41+
numpy = "^1.17.4"
42+
psutil = "^5.6.6"
43+
scipy = "^1.3.3"
44+
scikit-learn = "^0.22.2"
45+
Jinja2 = "^3.0.3"
3846

3947
[tool.poetry.dev-dependencies]
4048
pytest = "^4.6"

redisbench_admin/run/ann/ann.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pkg_resources
22

3+
34
ANN_MULTIRUN_PATH = pkg_resources.resource_filename(
45
"redisbench_admin", "run/ann/pkg/multirun.py"
56
)
@@ -12,8 +13,9 @@ def prepare_ann_benchmark_command(
1213
benchmark_config: object,
1314
results_file: str,
1415
current_workdir: str,
16+
ann_path: str,
1517
):
16-
command_arr = ["python3", ANN_MULTIRUN_PATH]
18+
command_arr = ["python3", ann_path]
1719

1820
if "arguments" in benchmark_config:
1921
command_arr.extend(benchmark_config["arguments"].strip().split(" "))
@@ -29,7 +31,10 @@ def prepare_ann_benchmark_command(
2931
if cluster_mode:
3032
command_arr.append("--cluster")
3133

32-
command_arr.extend(["--json-output", "{}/{}".format(current_workdir, results_file)])
34+
json_output = results_file
35+
if current_workdir is not None and not (results_file.startswith("/")):
36+
json_output = "{}/{}".format(current_workdir, results_file)
37+
command_arr.extend(["--json-output", json_output])
3338

3439
command_str = " ".join([str(x) for x in command_arr])
3540
return command_arr, command_str

redisbench_admin/run/common.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
from redisbench_admin.run.aibench_run_inference_redisai_vision.aibench_run_inference_redisai_vision import (
1616
prepare_aibench_benchmark_command,
1717
)
18-
from redisbench_admin.run.ann.ann import prepare_ann_benchmark_command
18+
from redisbench_admin.run.ann.ann import (
19+
prepare_ann_benchmark_command,
20+
ANN_MULTIRUN_PATH,
21+
)
1922
from redisbench_admin.run.ftsb.ftsb import prepare_ftsb_benchmark_command
2023
from redisbench_admin.run.memtier_benchmark.memtier_benchmark import (
2124
prepare_memtier_benchmark_command,
@@ -40,6 +43,9 @@
4043
parse_exporter_timemetric_definition,
4144
check_required_modules,
4245
)
46+
from redisbench_admin.utils.redisgraph_benchmark_go import (
47+
get_redisbench_admin_remote_path,
48+
)
4349
from redisbench_admin.utils.remote import (
4450
extract_perversion_timeseries_from_results,
4551
extract_perbranch_timeseries_from_results,
@@ -58,6 +64,10 @@ def prepare_benchmark_parameters(
5864
current_workdir=None,
5965
cluster_api_enabled=False,
6066
config_key="clientconfig",
67+
client_public_ip=None,
68+
username=None,
69+
private_key=None,
70+
client_ssh_port=None,
6171
):
6272
command_arr = None
6373
command_str = None
@@ -76,6 +86,10 @@ def prepare_benchmark_parameters(
7686
remote_results_file,
7787
server_plaintext_port,
7888
server_private_ip,
89+
client_public_ip,
90+
username,
91+
private_key,
92+
client_ssh_port,
7993
)
8094
# v0.4 spec
8195
elif type(benchmark_config[config_key]) == dict:
@@ -91,6 +105,10 @@ def prepare_benchmark_parameters(
91105
remote_results_file,
92106
server_plaintext_port,
93107
server_private_ip,
108+
client_public_ip,
109+
username,
110+
private_key,
111+
client_ssh_port,
94112
)
95113
printed_command_str = command_str
96114
printed_command_arr = command_arr
@@ -116,6 +134,10 @@ def prepare_benchmark_parameters_specif_tooling(
116134
remote_results_file,
117135
server_plaintext_port,
118136
server_private_ip,
137+
client_public_ip,
138+
username,
139+
private_key,
140+
client_ssh_port,
119141
):
120142
if "redis-benchmark" in benchmark_tool:
121143
command_arr, command_str = prepare_redis_benchmark_command(
@@ -178,13 +200,22 @@ def prepare_benchmark_parameters_specif_tooling(
178200
remote_results_file,
179201
)
180202
if "ann" in benchmark_tool:
203+
ann_path = ANN_MULTIRUN_PATH
204+
if isremote is True:
205+
[recv_exit_status, stdout, stderr] = get_redisbench_admin_remote_path(
206+
client_public_ip, username, private_key, client_ssh_port
207+
)[0]
208+
ann_path = stdout[0].strip() + "/run/ann/pkg/multirun.py"
209+
logging.info("Remote ann-benchmark path: {}".format(ann_path))
210+
181211
(command_arr, command_str,) = prepare_ann_benchmark_command(
182212
server_private_ip,
183213
server_plaintext_port,
184214
cluster_api_enabled,
185215
entry,
186216
remote_results_file,
187217
current_workdir,
218+
ann_path,
188219
)
189220
if "ftsb_" in benchmark_tool:
190221
input_data_file = None

redisbench_admin/run_remote/remote_client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
post_process_remote_run,
1717
)
1818
from redisbench_admin.utils.benchmark_config import extract_benchmark_tool_settings
19+
from redisbench_admin.utils.redisgraph_benchmark_go import setup_remote_benchmark_ann
1920
from redisbench_admin.utils.remote import (
2021
execute_remote_commands,
2122
fetch_file_from_remote_setup,
@@ -72,6 +73,14 @@ def run_remote_client_tool(
7273
client_ssh_port,
7374
private_key,
7475
)
76+
if "ann-benchmarks" in benchmark_tool:
77+
logging.info(
78+
"Ensuring that the ann-benchmark being used is the latest version release within the redisbench-admin package"
79+
)
80+
setup_remote_benchmark_ann(
81+
client_public_ip, username, private_key, client_ssh_port
82+
)
83+
7584
command, command_str = prepare_benchmark_parameters(
7685
benchmark_config,
7786
benchmark_tool,
@@ -82,6 +91,10 @@ def run_remote_client_tool(
8291
None,
8392
cluster_api_enabled,
8493
config_key,
94+
client_public_ip,
95+
username,
96+
private_key,
97+
client_ssh_port,
8598
)
8699
tmp = None
87100
if benchmark_tool == "redis-benchmark":

redisbench_admin/run_remote/run_remote.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def run_remote_command_logic(args, project_name, project_version):
105105
private_key = args.private_key
106106
grafana_profile_dashboard = args.grafana_profile_dashboard
107107
profilers_enabled = args.enable_profilers
108+
keep_env_and_topo = args.keep_env_and_topo
108109

109110
if args.skip_env_vars_verify is False:
110111
check_ec2_env()
@@ -606,7 +607,7 @@ def run_remote_command_logic(args, project_name, project_version):
606607
)
607608

608609
if setup_details["env"] is None:
609-
if args.keep_env_and_topo is False:
610+
if keep_env_and_topo is False:
610611
shutdown_remote_redis(
611612
redis_conns, ssh_tunnel
612613
)
@@ -728,7 +729,9 @@ def run_remote_command_logic(args, project_name, project_version):
728729
"Detected Keyboard interruput...Destroy all remote envs and exiting right away!"
729730
)
730731
if args.inventory is None:
731-
terraform_destroy(remote_envs)
732+
terraform_destroy(
733+
remote_envs, keep_env_and_topo
734+
)
732735
exit(1)
733736
except:
734737
(
@@ -771,7 +774,7 @@ def run_remote_command_logic(args, project_name, project_version):
771774
)
772775
writer.write_table()
773776
if args.inventory is None:
774-
terraform_destroy(remote_envs)
777+
terraform_destroy(remote_envs, keep_env_and_topo)
775778

776779
if args.push_results_redistimeseries:
777780
for setup_name, setup_target_table in overall_tables.items():

redisbench_admin/run_remote/terraform.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,20 @@ def terraform_spin_or_reuse_env(
8686
)
8787

8888

89-
def terraform_destroy(remote_envs):
90-
for remote_setup_name, tf in remote_envs.items():
91-
# tear-down
92-
logging.info("Tearing down setup {}".format(remote_setup_name))
93-
tf.destroy(
94-
capture_output="yes",
95-
no_color=IsNotFlagged,
96-
force=IsNotFlagged,
97-
auto_approve=True,
98-
)
89+
def terraform_destroy(remote_envs, keep_env=False):
90+
if keep_env is False:
91+
for remote_setup_name, tf in remote_envs.items():
92+
# tear-down
93+
logging.info("Tearing down setup {}".format(remote_setup_name))
94+
tf.destroy(
95+
capture_output="yes",
96+
no_color=IsNotFlagged,
97+
force=IsNotFlagged,
98+
auto_approve=True,
99+
)
99100
logging.info("Tear-down completed")
101+
else:
102+
logging.info("Keeping the environment UP uppon request")
100103

101104

102105
def retrieve_inventory_info(inventory_str):

redisbench_admin/utils/redisgraph_benchmark_go.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,33 @@
99
)
1010

1111

12+
def get_redisbench_admin_remote_path(
13+
client_public_ip, username, private_key, client_ssh_port
14+
):
15+
commands = [
16+
"python3 -c 'import os; import redisbench_admin; print(os.path.dirname(redisbench_admin.__file__))'"
17+
]
18+
# last argument (get_pty) needs to be set to true
19+
# check: https://stackoverflow.com/questions/5785353/paramiko-and-sudo
20+
return execute_remote_commands(
21+
client_public_ip, username, private_key, commands, client_ssh_port, True
22+
)
23+
24+
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+
1239
def setup_remote_benchmark_agent(
1340
client_public_ip, username, private_key, client_ssh_port
1441
):

tests/test_ann.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_prepare_ann_benchmark_command():
2424
)
2525
assert (
2626
" ".join(command_arr[2:])
27-
== '--algorithm redisearch-hnsw --dataset mnist-784-euclidean --run-group M-4 --count 1 --build-clients 1 --test-clients 0 --host localhost --port 6379 --json-output ./result.json'
27+
== "--algorithm redisearch-hnsw --dataset mnist-784-euclidean --run-group M-4 --count 1 --build-clients 1 --test-clients 0 --host localhost --port 6379 --json-output ./result.json"
2828
)
2929

3030

0 commit comments

Comments
 (0)