Skip to content

Commit 5a377c3

Browse files
Added --skip-teardown, --run-only-steps, --continue-on-error steps to redisbench-admin run sub command (#22)
* [add] Added --skip-teardown, --run-only-steps, --continue-on-error steps to redisbench-admin run sub command
1 parent 4684c16 commit 5a377c3

File tree

3 files changed

+48
-19
lines changed

3 files changed

+48
-19
lines changed

redisbench_admin/run/args.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ def create_run_arguments(parser):
33
help="benchmark config file to read instructions from. can be a local file or a remote link")
44
parser.add_argument('--workers', type=str, default=0,
55
help='number of workers to use during the benchark. If set to 0 it will auto adjust based on the machine number of VCPUs')
6+
parser.add_argument('--run-only-steps', type=str, default="",
7+
help='Comma separated list of use-case steps to run. By default it will run all specified steps.')
68
parser.add_argument('--repetitions', type=int, default=1,
79
help='number of repetitions to run')
810
parser.add_argument('--benchmark-requests', type=int, default=0,
@@ -16,6 +18,10 @@ def create_run_arguments(parser):
1618
help='number of database shards used in the deployment')
1719
parser.add_argument('--pipeline', type=int, default=1,
1820
help='pipeline requests to Redis')
21+
parser.add_argument('--skip-teardown', default=False, action='store_true',
22+
help="If enabled will skip any teardown steps.")
23+
parser.add_argument('--continue-on-error', default=False, action='store_true',
24+
help="If enabled will continue on Redis ERR replies and only print the message.")
1925
parser.add_argument('--cluster-mode', default=False, action='store_true', help="Run client in cluster mode")
2026
parser.add_argument('--max-rps', type=int, default=0,
2127
help="enable limiting the rate of queries per second, 0 = no limit. " + "By default no limit is specified and the binaries will stress the DB up to the maximum.")

redisbench_admin/run/ftsb_redisearch/ftsb_redisearch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def get_run_options():
3333

3434

3535
def run_ftsb_redisearch(redis_url, ftsb_redisearch_path, setup_run_json_output_fullpath, options, input_file, workers=1,
36-
pipeline=1, oss_cluster_mode=False, max_rps=0, requests=0, args=[] ):
36+
pipeline=1, oss_cluster_mode=False, max_rps=0, requests=0, continue_on_error=False, args=[] ):
3737
##################
3838
# Setup commands #
3939
##################
@@ -49,7 +49,8 @@ def run_ftsb_redisearch(redis_url, ftsb_redisearch_path, setup_run_json_output_f
4949
ftsb_args += ["--requests={}".format(requests)]
5050
if oss_cluster_mode:
5151
ftsb_args += ["--cluster-mode"]
52-
ftsb_args += ["--continue-on-error"]
52+
if continue_on_error:
53+
ftsb_args += ["--continue-on-error"]
5354

5455
ftsb_process = subprocess.Popen(args=ftsb_args, **options)
5556
if ftsb_process.poll() is not None:

redisbench_admin/run/run.py

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ def run_command_logic(args):
3030
oss_cluster_mode = args.cluster_mode
3131
max_rps = args.max_rps
3232
requests = args.requests
33+
continue_on_error = args.continue_on_error
34+
run_only_steps = None
35+
skip_teardown = args.skip_teardown
36+
if args.run_only_steps != "":
37+
run_only_steps = args.run_only_steps.split(",")
38+
3339

3440
benchmark_machine_info = cpuinfo.get_cpu_info()
3541
total_cores = benchmark_machine_info['count']
@@ -124,30 +130,46 @@ def run_command_logic(args):
124130
if benchmark_repetitions_require_teardown is True or repetition == 1:
125131
aux_client = run_setup_commands(args, "setup", benchmark_config["setup"]["commands"], oss_cluster_mode)
126132
if "setup" in run_stages_inputs:
127-
setup_run_key = "setup-run-{}.json".format(repetition)
128-
setup_run_json_output_fullpath = "{}/{}".format(local_path, setup_run_key)
129-
input_file = run_stages_inputs["setup"]
130-
benchmark_output_dict["setup"][setup_run_key] = run_ftsb_redisearch(args.redis_url, benchmark_tool_path,
131-
setup_run_json_output_fullpath,
132-
options, input_file, workers,
133-
pipeline, oss_cluster_mode, 0, 0)
133+
run_setup_step = True
134+
if run_only_steps is not None and "setup" not in run_only_steps:
135+
run_setup_step = False
136+
if run_setup_step:
137+
setup_run_key = "setup-run-{}.json".format(repetition)
138+
setup_run_json_output_fullpath = "{}/{}".format(local_path, setup_run_key)
139+
input_file = run_stages_inputs["setup"]
140+
benchmark_output_dict["setup"][setup_run_key] = run_ftsb_redisearch(args.redis_url, benchmark_tool_path,
141+
setup_run_json_output_fullpath,
142+
options, input_file, workers,
143+
pipeline, oss_cluster_mode, 0, 0, continue_on_error)
144+
else:
145+
print("Skipping setup step since it's not present in: {}".format(run_only_steps))
134146
progress.update()
135147

136148
######################
137149
# Benchmark commands #
138150
######################
139-
benchmark_run_key = "benchmark-run-{}.json".format(repetition)
140-
benchmark_run_json_output_fullpath = "{}/{}".format(local_path, benchmark_run_key)
141-
input_file = run_stages_inputs["benchmark"]
142-
143-
benchmark_output_dict["benchmark"][benchmark_run_key] = run_ftsb_redisearch(args.redis_url, benchmark_tool_path,
144-
benchmark_run_json_output_fullpath,
145-
options, input_file, workers,
146-
pipeline, oss_cluster_mode, max_rps, requests)
151+
run_benchmark_step = True
152+
if run_only_steps is not None and "benchmark" not in run_only_steps:
153+
run_benchmark_step = False
154+
155+
if run_benchmark_step:
156+
benchmark_run_key = "benchmark-run-{}.json".format(repetition)
157+
benchmark_run_json_output_fullpath = "{}/{}".format(local_path, benchmark_run_key)
158+
input_file = run_stages_inputs["benchmark"]
159+
160+
benchmark_output_dict["benchmark"][benchmark_run_key] = run_ftsb_redisearch(args.redis_url, benchmark_tool_path,
161+
benchmark_run_json_output_fullpath,
162+
options, input_file, workers,
163+
pipeline, oss_cluster_mode, max_rps, requests, continue_on_error)
164+
else:
165+
print("Skipping benchmark step since it's not present in: {}".format(run_only_steps))
147166

148167
if benchmark_repetitions_require_teardown is True or repetition == args.repetitions:
149-
print("Running tear down steps...")
150-
run_setup_commands(args, "tear down", benchmark_config["teardown"]["commands"], oss_cluster_mode)
168+
if skip_teardown is False:
169+
print("Running tear down steps...")
170+
run_setup_commands(args, "tear down", benchmark_config["teardown"]["commands"], oss_cluster_mode)
171+
else:
172+
print("Implicitly skipping teardown step due to --skip-teardown flag")
151173

152174
progress.update()
153175
end_time = dt.datetime.now()

0 commit comments

Comments
 (0)