Skip to content

Commit b2e36d6

Browse files
Fixed ann remote running command (#303)
1 parent 6ab4242 commit b2e36d6

File tree

7 files changed

+22
-19
lines changed

7 files changed

+22
-19
lines changed

redisbench_admin/run/ann/ann.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def prepare_ann_benchmark_command(
1515
current_workdir: str,
1616
ann_path: str,
1717
):
18-
command_arr = ["python3", ann_path]
18+
command_arr = ["sudo", "python3", ann_path]
1919

2020
if "arguments" in benchmark_config:
2121
command_arr.extend(benchmark_config["arguments"].strip().split(" "))

redisbench_admin/run_local/local_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def local_db_spin(
9595
if status is False:
9696
raise Exception("Redis cluster setup failed. Failing test.")
9797

98-
dataset, _, _ = check_dataset_local_requirements(
98+
dataset, dataset_name, _, _ = check_dataset_local_requirements(
9999
benchmark_config,
100100
temporary_dir,
101101
dirname,

redisbench_admin/run_remote/run_remote.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# All rights reserved.
55
#
66
import logging
7+
import random
8+
import string
79
import sys
810
import traceback
911
import redis
@@ -188,10 +190,12 @@ def run_remote_command_logic(args, project_name, project_version):
188190
overall_tables = {}
189191

190192
for benchmark_type, bench_by_dataset_map in benchmark_runs_plan.items():
193+
logging.info("Running benchmarks of type {}.".format(benchmark_type))
191194
for (
192195
dataset_name,
193196
bench_by_dataset_and_setup_map,
194197
) in bench_by_dataset_map.items():
198+
logging.info("Running benchmarks for dataset {}.".format(dataset_name))
195199
for setup_name, setup_details in bench_by_dataset_and_setup_map.items():
196200

197201
setup_settings = setup_details["setup_settings"]
@@ -235,15 +239,7 @@ def run_remote_command_logic(args, project_name, project_version):
235239
)
236240
)
237241
if "remote" in benchmark_config:
238-
import string
239-
import random
240-
241-
temporary_dir = "/tmp/{}".format(
242-
"".join(
243-
random.choice(string.ascii_lowercase)
244-
for i in range(20)
245-
)
246-
)
242+
temporary_dir = get_tmp_folder_rnd()
247243
(
248244
client_public_ip,
249245
server_plaintext_port,
@@ -366,7 +362,7 @@ def run_remote_command_logic(args, project_name, project_version):
366362
return_code,
367363
server_plaintext_port,
368364
ssh_tunnel,
369-
) = ro_benchmar_reuse(
365+
) = ro_benchmark_reuse(
370366
artifact_version,
371367
benchmark_type,
372368
cluster_enabled,
@@ -813,7 +809,14 @@ def run_remote_command_logic(args, project_name, project_version):
813809
exit(return_code)
814810

815811

816-
def ro_benchmar_reuse(
812+
def get_tmp_folder_rnd():
813+
temporary_dir = "/tmp/{}".format(
814+
"".join(random.choice(string.ascii_lowercase) for i in range(20))
815+
)
816+
return temporary_dir
817+
818+
819+
def ro_benchmark_reuse(
817820
artifact_version,
818821
benchmark_type,
819822
cluster_enabled,

redisbench_admin/utils/local.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ def check_dataset_local_requirements(
2323
is_cluster=False,
2424
):
2525
dataset = None
26+
dataset_name = None
2627
full_path = None
2728
tmp_path = None
2829
if dbconfig_keyname in benchmark_config:
2930
for k in benchmark_config[dbconfig_keyname]:
3031
if "dataset" in k:
3132
dataset = k["dataset"]
33+
if "dataset_name" in k:
34+
dataset_name = k["dataset_name"]
3235
if dataset is not None:
3336
full_path = check_if_needs_remote_fetch(
3437
dataset, datasets_localtemp_dir, dirname
@@ -50,7 +53,7 @@ def check_dataset_local_requirements(
5053
)
5154
copyfile(full_path, tmp_path)
5255

53-
return dataset, full_path, tmp_path
56+
return dataset, dataset_name, full_path, tmp_path
5457

5558

5659
def check_if_needs_remote_fetch(

redisbench_admin/utils/remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def check_dataset_remote_requirements(
169169
db_ssh_port=22,
170170
):
171171
res = True
172-
dataset, fullpath, tmppath = check_dataset_local_requirements(
172+
dataset, dataset_name, fullpath, tmppath = check_dataset_local_requirements(
173173
benchmark_config,
174174
".",
175175
dirname,

tests/test_ann.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_prepare_ann_benchmark_command():
2323
".",
2424
)
2525
assert (
26-
" ".join(command_arr[2:])
26+
" ".join(command_arr[3:])
2727
== "--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

tests/test_local.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
import redis
66

7-
from redisbench_admin.utils.local import (
8-
check_dataset_local_requirements,
9-
)
107
from redisbench_admin.environments.oss_standalone import (
118
spin_up_local_redis,
129
generate_standalone_redis_server_args,

0 commit comments

Comments
 (0)