Skip to content

Commit 4bc1713

Browse files
[fix] on parse error use current timestamp (#251)
1 parent 83c996e commit 4bc1713

File tree

6 files changed

+40
-8
lines changed

6 files changed

+40
-8
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.5.24"
3+
version = "0.5.25"
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/common.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,15 @@ def common_exporter_logic(
238238
datapoints_timestamp = parse_exporter_timemetric(
239239
exporter_timemetric_path, results_dict
240240
)
241+
if datapoints_timestamp is None:
242+
datapoints_timestamp = int(
243+
datetime.datetime.now(datetime.timezone.utc).timestamp() * 1000.0
244+
)
245+
logging.warning(
246+
"Error while trying to parse datapoints timestamp. Using current system timestamp Error: {}".format(
247+
datapoints_timestamp
248+
)
249+
)
241250
if (
242251
artifact_version is not None
243252
and artifact_version != ""

redisbench_admin/run/ycsb/ycsb.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,22 @@ def prepare_ycsb_benchmark_command(
2626
workload = None
2727
threads = None
2828
override_workload_properties = []
29-
for k in benchmark_config["parameters"]:
29+
if type(benchmark_config["parameters"]) == list:
30+
for k in benchmark_config["parameters"]:
31+
if "database" in k:
32+
database = k["database"]
33+
if "step" in k:
34+
step = k["step"]
35+
if "workload" in k:
36+
workload = k["workload"]
37+
if current_workdir is not None and workload.startswith("./"):
38+
workload = "{}{}".format(current_workdir, workload[1:])
39+
if "threads" in k:
40+
threads = k["threads"]
41+
if "override_workload_properties" in k:
42+
override_workload_properties = k["override_workload_properties"]
43+
if type(benchmark_config["parameters"]) == dict:
44+
k = benchmark_config["parameters"]
3045
if "database" in k:
3146
database = k["database"]
3247
if "step" in k:
@@ -47,9 +62,10 @@ def prepare_ycsb_benchmark_command(
4762
if threads:
4863
command_arr.extend(["-p", '"threadcount={}"'.format(threads)])
4964

50-
command_arr.extend(["-p", '"redis.host={}"'.format(server_private_ip)])
51-
52-
command_arr.extend(["-p", '"redis.port={}"'.format(server_plaintext_port)])
65+
if server_private_ip is not None:
66+
command_arr.extend(["-p", '"redis.host={}"'.format(server_private_ip)])
67+
if server_plaintext_port is not None:
68+
command_arr.extend(["-p", '"redis.port={}"'.format(server_plaintext_port)])
5369

5470
for prop in override_workload_properties:
5571
for k, v in prop.items():

redisbench_admin/run_remote/run_remote.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,13 @@ def run_remote_command_logic(args, project_name, project_version):
614614
setup_name,
615615
test_name,
616616
)
617-
617+
except KeyboardInterrupt:
618+
logging.critical(
619+
"Detected Keyboard interruput...Destroy all remote envs and exiting right away!"
620+
)
621+
if args.inventory is None:
622+
terraform_destroy(remote_envs)
623+
exit(1)
618624
except:
619625
(
620626
start_time,

redisbench_admin/utils/benchmark_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ def parse_exporter_timemetric(metric_path: str, results_dict: dict):
3939
datapoints_timestamp = None
4040
try:
4141
jsonpath_expr = parse(metric_path)
42-
datapoints_timestamp = int(jsonpath_expr.find(results_dict)[0].value)
42+
find_res = jsonpath_expr.find(results_dict)
43+
if len(find_res) > 0:
44+
datapoints_timestamp = int(find_res[0].value)
4345
except Exception as e:
4446
logging.error(
4547
"Unable to parse time-metric {}. Error: {}".format(metric_path, e.__str__())

redisbench_admin/utils/remote.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,6 @@ def fetch_remote_setup_from_config(
505505

506506

507507
def push_data_to_redistimeseries(rts, time_series_dict: dict):
508-
logging.info(time_series_dict)
509508
datapoint_errors = 0
510509
datapoint_inserts = 0
511510
if rts is not None and time_series_dict is not None:

0 commit comments

Comments
 (0)