Skip to content

Commit 0b1d9de

Browse files
authored
run initialization commands before benchmark starts (#125)
1 parent eaa6368 commit 0b1d9de

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

redisbench_admin/run_local/run_local.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ def run_local_command_logic(args):
155155

156156
check_required_modules(module_names, required_modules)
157157

158+
# run initialization commands before benchmark starts
159+
execute_init_commands(benchmark_config, r)
160+
158161
# setup the benchmark
159162
start_time, start_time_ms, start_time_str = get_start_time_vars()
160163
local_benchmark_output_filename = get_local_run_full_filename(
@@ -499,3 +502,16 @@ def which_local(benchmark_tool, executable, full_path, which_benchmark_tool):
499502
which_benchmark_tool = full_path_filename
500503
break
501504
return which_benchmark_tool
505+
506+
507+
def execute_init_commands(benchmark_config, r, dbconfig_keyname="dbconfig"):
508+
cmds = None
509+
if dbconfig_keyname in benchmark_config:
510+
for k in benchmark_config[dbconfig_keyname]:
511+
if "init_commands" in k:
512+
cmds = k["init_commands"]
513+
if cmds is not None:
514+
for cmd in cmds:
515+
cmd_split = cmd.split(None, 2)
516+
stdout = r.execute_command(*cmd_split)
517+
print(stdout)

0 commit comments

Comments
 (0)