Skip to content

Commit f36f11a

Browse files
Fix redis-benchmark v6.2.4 WARNING:* parsing (#146)
* Bumping version from 0.2.11 to 0.2.12 * [fix] Fixed redis-benchmark v6.2.4 WARNING:* additions
1 parent e482191 commit f36f11a

File tree

16 files changed

+361
-56
lines changed

16 files changed

+361
-56
lines changed

poetry.lock

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ PyYAML = "^5.4.0"
2828
wget = "^3.2"
2929
pytablewriter = "^0.60.0"
3030
sshtunnel = "^0.4.0"
31+
pyWorkFlow = "^0.0.2"
3132

3233
[tool.poetry.dev-dependencies]
3334
pytest = "^4.6"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Apache License Version 2.0
2+
#
3+
# Copyright (c) 2021., Redis Labs Modules
4+
# All rights reserved.
5+
#
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Apache License Version 2.0
2+
#
3+
# Copyright (c) 2021., Redis Labs Modules
4+
# All rights reserved.
5+
#
6+
7+
from redisbench_admin.utils.local import check_if_needs_remote_fetch
8+
9+
10+
def prepare_aibench_benchmark_command(
11+
executable_path: str,
12+
server_private_ip: object,
13+
server_plaintext_port: object,
14+
benchmark_config: object,
15+
current_workdir,
16+
result_file: str,
17+
remote_queries_file,
18+
is_remote: bool,
19+
):
20+
command_arr = [executable_path]
21+
22+
command_arr.extend(["--host", "{}".format(server_private_ip)])
23+
command_arr.extend(["--port", "{}".format(server_plaintext_port)])
24+
if "parameters" in benchmark_config:
25+
for k in benchmark_config["parameters"]:
26+
if "file" in k:
27+
input_file = k["file"]
28+
input_file = check_if_needs_remote_fetch(
29+
input_file, "/tmp", None, remote_queries_file, is_remote
30+
)
31+
command_arr.extend(["--file", input_file])
32+
else:
33+
for kk in k.keys():
34+
command_arr.extend(["--{}".format(kk), str(k[kk])])
35+
36+
command_arr.extend(["--json-out-file", result_file])
37+
38+
command_str = " ".join(command_arr)
39+
return command_arr, command_str

redisbench_admin/run/common.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
import redis
1212

13+
from redisbench_admin.run.aibench_run_inference_redisai_vision.aibench_run_inference_redisai_vision import (
14+
prepare_aibench_benchmark_command,
15+
)
1316
from redisbench_admin.run.redis_benchmark.redis_benchmark import (
1417
prepare_redis_benchmark_command,
1518
)
@@ -96,6 +99,21 @@ def prepare_benchmark_parameters(
9699
input_data_file,
97100
isremote,
98101
)
102+
if "aibench_" in benchmark_tool:
103+
input_data_file = None
104+
if isremote is True:
105+
benchmark_tool = "/tmp/{}".format(benchmark_tool)
106+
input_data_file = "/tmp/input.data"
107+
(command_arr, command_str,) = prepare_aibench_benchmark_command(
108+
benchmark_tool,
109+
server_private_ip,
110+
server_plaintext_port,
111+
entry,
112+
current_workdir,
113+
remote_results_file,
114+
input_data_file,
115+
isremote,
116+
)
99117
printed_command_str = command_str
100118
printed_command_arr = command_arr
101119
if len(command_str) > 200:

redisbench_admin/run/redis_benchmark/redis_benchmark.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,25 @@ def redis_benchmark_from_stdout_csv_to_json(
2222
"StartTimeHuman": start_time_str,
2323
}
2424
csv_data = csv_data.splitlines()
25-
full_csv = list(csv.reader(csv_data, delimiter=",", quoting=csv.QUOTE_ALL))
26-
if len(full_csv) >= 2:
27-
header = full_csv[0]
28-
for raw_row in csv_data[1:]:
29-
row = raw_row.rsplit(",", len(header) - 1)
30-
assert len(row) == len(header)
31-
test_name = row[0][1:-1].split(" ")[0]
32-
if overload_test_name is not None:
33-
test_name = overload_test_name
34-
results_dict["Tests"][test_name] = {}
35-
for pos, value in enumerate(row[1:]):
36-
if '"' == value[0]:
37-
value = value[1:]
38-
if '"' == value[-1]:
39-
value = value[:-1]
40-
results_dict["Tests"][test_name][header[pos + 1]] = value
25+
if len(csv_data) > 0:
26+
if "WARNING:" in csv_data[0]:
27+
csv_data = csv_data[1:]
28+
full_csv = list(csv.reader(csv_data, delimiter=",", quoting=csv.QUOTE_ALL))
29+
if len(full_csv) >= 2:
30+
header = full_csv[0]
31+
for raw_row in csv_data[1:]:
32+
row = raw_row.rsplit(",", len(header) - 1)
33+
assert len(row) == len(header)
34+
test_name = row[0][1:-1].split(" ")[0]
35+
if overload_test_name is not None:
36+
test_name = overload_test_name
37+
results_dict["Tests"][test_name] = {}
38+
for pos, value in enumerate(row[1:]):
39+
if '"' == value[0]:
40+
value = value[1:]
41+
if '"' == value[-1]:
42+
value = value[:-1]
43+
results_dict["Tests"][test_name][header[pos + 1]] = value
4144
return results_dict
4245

4346

redisbench_admin/run/tsbs_run_queries_redistimeseries/tsbs_run_queries_redistimeseries.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Copyright (c) 2021., Redis Labs Modules
44
# All rights reserved.
55
#
6-
import csv
7-
import re
86

97
from redisbench_admin.utils.local import check_if_needs_remote_fetch
108

@@ -49,30 +47,3 @@ def prepare_tsbs_benchmark_command(
4947

5048
command_str = " ".join(command_arr)
5149
return command_arr, command_str
52-
53-
54-
def post_process_ycsb_results(stdout, start_time_ms, start_time_str):
55-
results_dict = {
56-
"Tests": {},
57-
"StartTime": start_time_ms,
58-
"StartTimeHuman": start_time_str,
59-
}
60-
if type(stdout) == bytes:
61-
stdout = stdout.decode("ascii")
62-
csv_data = list(csv.reader(stdout.splitlines(), delimiter=","))
63-
start_row = 0
64-
for row in csv_data:
65-
if len(row) >= 1:
66-
if "[OVERALL]" in row[0]:
67-
break
68-
start_row = start_row + 1
69-
for row in csv_data[start_row:]:
70-
if len(row) >= 3:
71-
op_group = row[0].strip()[1:-1]
72-
metric_name = row[1].strip()
73-
metric_name = re.sub("[^0-9a-zA-Z]+", "_", metric_name)
74-
value = row[2].strip()
75-
if op_group not in results_dict["Tests"]:
76-
results_dict["Tests"][op_group] = {}
77-
results_dict["Tests"][op_group][metric_name] = value
78-
return results_dict

redisbench_admin/run_local/args.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,19 @@
1919

2020

2121
def create_run_local_arguments(parser):
22-
parser.add_argument("--module_path", type=str, required=True)
22+
parser.add_argument("--module_path", type=str, required=False)
23+
parser.add_argument(
24+
"--dbdir_folder",
25+
type=str,
26+
required=False,
27+
help="If specified the entire contents of the folder are copied to the redis dir.",
28+
)
2329
parser.add_argument(
2430
"--allowed-tools",
2531
type=str,
26-
default="redis-benchmark,redisgraph-benchmark-go,ycsb,tsbs_run_queries_redistimeseries,tsbs_load_redistimeseries",
32+
default="redis-benchmark,redisgraph-benchmark-go,ycsb,"
33+
+ "tsbs_run_queries_redistimeseries,tsbs_load_redistimeseries,"
34+
+ "aibench_run_inference_redisai_vision",
2735
help="comma separated list of allowed tools for this module. By default all the supported are allowed.",
2836
)
2937
parser.add_argument(

redisbench_admin/run_local/run_local.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def run_local_command_logic(args):
6969
) = extract_git_vars()
7070

7171
local_module_file = args.module_path
72+
dbdir_folder = args.dbdir_folder
7273
os.path.abspath(".")
7374
required_modules = args.required_module
7475
profilers_enabled = args.enable_profilers
@@ -145,6 +146,16 @@ def run_local_command_logic(args):
145146
temporary_dir
146147
)
147148
)
149+
if dbdir_folder is not None:
150+
from distutils.dir_util import copy_tree
151+
152+
copy_tree(dbdir_folder, temporary_dir)
153+
logging.info(
154+
"Copied entire content of {} into temporary path: {}".format(
155+
dbdir_folder, temporary_dir
156+
)
157+
)
158+
148159
check_dataset_local_requirements(
149160
benchmark_config, temporary_dir, dirname
150161
)
@@ -158,6 +169,7 @@ def run_local_command_logic(args):
158169
args.port,
159170
local_module_file,
160171
redis_configuration_parameters,
172+
dbdir_folder,
161173
)
162174

163175
if is_process_alive(redis_process) is False:
@@ -305,6 +317,7 @@ def run_local_command_logic(args):
305317
artifact_name,
306318
profile_artifact,
307319
) in profile_res_artifacts_map.items():
320+
s3_link = None
308321
if args.upload_results_s3:
309322
logging.info(
310323
"Uploading results to s3. s3 bucket name: {}. s3 bucket path: {}".format(
@@ -316,7 +329,7 @@ def run_local_command_logic(args):
316329
s3_bucket_name,
317330
s3_bucket_path,
318331
)
319-
s3_link = list(url_map.values())[0]
332+
s3_link = list(url_map.values())[0]
320333
profilers_artifacts_matrix.append(
321334
[
322335
test_name,

redisbench_admin/run_remote/args.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,19 @@
2121

2222

2323
def create_run_remote_arguments(parser):
24-
parser.add_argument("--module_path", type=str, required=True)
24+
parser.add_argument("--module_path", type=str, required=False)
25+
parser.add_argument(
26+
"--dbdir_folder",
27+
type=str,
28+
required=False,
29+
help="If specified the entire contents of the folder are copied to the redis dir.",
30+
)
2531
parser.add_argument(
2632
"--allowed-tools",
2733
type=str,
28-
default="redis-benchmark,redisgraph-benchmark-go,ycsb,tsbs_run_queries_redistimeseries,tsbs_load_redistimeseries",
34+
default="redis-benchmark,redisgraph-benchmark-go,ycsb,"
35+
+ "tsbs_run_queries_redistimeseries,tsbs_load_redistimeseries,"
36+
+ "aibench_run_inference_redisai_vision",
2937
help="comma separated list of allowed tools for this module. By default all the supported are allowed.",
3038
)
3139
parser.add_argument(

0 commit comments

Comments
 (0)