Skip to content

Commit 9c800c3

Browse files
Fixed init_commands and db_config format (#457)
1 parent f432c88 commit 9c800c3

File tree

5 files changed

+30
-10
lines changed

5 files changed

+30
-10
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.11.52"
3+
version = "0.11.53"
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/aibench_run_inference_redisai_vision/aibench_run_inference_redisai_vision.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ def extract_aibench_extra_links(benchmark_config, benchmark_tool):
4747
)
4848
queries_file_link = None
4949
for entry in benchmark_config["clientconfig"]:
50-
if "parameters" in entry:
50+
# Handle both dict and non-dict entries in the list
51+
if isinstance(entry, dict) and "parameters" in entry:
5152
for parameter in entry["parameters"]:
5253
if "file" in parameter:
5354
queries_file_link = parameter["file"]

redisbench_admin/run/common.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,17 @@ def get_start_time_vars(start_time=None):
404404
def check_dbconfig_tool_requirement(benchmark_config, dbconfig_keyname="dbconfig"):
405405
required = False
406406
if dbconfig_keyname in benchmark_config:
407-
for k in benchmark_config[dbconfig_keyname]:
408-
if "tool" in k:
407+
dbconfig = benchmark_config[dbconfig_keyname]
408+
# Handle both dict and list formats
409+
if isinstance(dbconfig, dict):
410+
# New format: dbconfig is a dict
411+
if "tool" in dbconfig:
409412
required = True
413+
elif isinstance(dbconfig, list):
414+
# Old format: dbconfig is a list of dicts
415+
for k in dbconfig:
416+
if isinstance(k, dict) and "tool" in k:
417+
required = True
410418
return required
411419

412420

@@ -418,7 +426,8 @@ def check_dbconfig_keyspacelen_requirement(
418426
if dbconfig_keyname in benchmark_config:
419427
if type(benchmark_config[dbconfig_keyname]) == list:
420428
for k in benchmark_config[dbconfig_keyname]:
421-
if "check" in k:
429+
# Handle both dict and non-dict entries in the list
430+
if isinstance(k, dict) and "check" in k:
422431
if "keyspacelen" in k["check"]:
423432
required = True
424433
keyspacelen = int(k["check"]["keyspacelen"])
@@ -436,9 +445,17 @@ def execute_init_commands(benchmark_config, r, dbconfig_keyname="dbconfig"):
436445
cmds = None
437446
res = 0
438447
if dbconfig_keyname in benchmark_config:
439-
for k in benchmark_config[dbconfig_keyname]:
440-
if "init_commands" in k:
441-
cmds = k["init_commands"]
448+
dbconfig = benchmark_config[dbconfig_keyname]
449+
# Handle both dict and list formats
450+
if isinstance(dbconfig, dict):
451+
# New format: dbconfig is a dict
452+
if "init_commands" in dbconfig:
453+
cmds = dbconfig["init_commands"]
454+
elif isinstance(dbconfig, list):
455+
# Old format: dbconfig is a list of dicts
456+
for k in dbconfig:
457+
if isinstance(k, dict) and "init_commands" in k:
458+
cmds = k["init_commands"]
442459
if cmds is not None:
443460
for cmd in cmds:
444461
is_array = False

redisbench_admin/run/ftsb/ftsb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def extract_ftsb_extra_links(
6868
)
6969
queries_file_link = None
7070
for entry in benchmark_config[config_key]:
71-
if "parameters" in entry:
71+
# Handle both dict and non-dict entries in the list
72+
if isinstance(entry, dict) and "parameters" in entry:
7273
for parameter in entry["parameters"]:
7374
if "input" in parameter:
7475
queries_file_link = parameter["input"]

redisbench_admin/run/tsbs_run_queries_redistimeseries/tsbs_run_queries_redistimeseries.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def extract_remote_tool_extra_links(
7070
)
7171
queries_file_link = None
7272
for entry in benchmark_config[config_key]:
73-
if "parameters" in entry:
73+
# Handle both dict and non-dict entries in the list
74+
if isinstance(entry, dict) and "parameters" in entry:
7475
for parameter in entry["parameters"]:
7576
if "file" in parameter:
7677
queries_file_link = parameter["file"]

0 commit comments

Comments
 (0)