|
28 | 28 | )
|
29 | 29 | from redisbench_admin.run.metrics import extract_results_table
|
30 | 30 | from redisbench_admin.run.run import calculate_client_tool_duration_and_check
|
31 |
| -from redisbench_admin.utils.benchmark_config import get_final_benchmark_config |
| 31 | +from redisbench_admin.utils.benchmark_config import ( |
| 32 | + get_final_benchmark_config, |
| 33 | + get_defaults, |
| 34 | +) |
32 | 35 | from redisbench_admin.utils.local import get_local_run_full_filename
|
33 | 36 | from redisbench_admin.utils.results import post_process_benchmark_results
|
34 | 37 |
|
@@ -215,6 +218,7 @@ def prepare_memtier_benchmark_parameters(
|
215 | 218 | tls_cacert=None,
|
216 | 219 | resp_version=None,
|
217 | 220 | override_memtier_test_time=0,
|
| 221 | + override_test_runs=1, |
218 | 222 | ):
|
219 | 223 | benchmark_command = [
|
220 | 224 | full_benchmark_path,
|
@@ -253,6 +257,62 @@ def prepare_memtier_benchmark_parameters(
|
253 | 257 | if "arguments" in clientconfig:
|
254 | 258 | benchmark_command_str = benchmark_command_str + " " + clientconfig["arguments"]
|
255 | 259 | logging.info(override_memtier_test_time)
|
| 260 | + |
| 261 | + if override_test_runs > 1: |
| 262 | + benchmark_command_str = re.sub( |
| 263 | + "--run-count\\s\\d+", |
| 264 | + "--run-count={}".format(override_test_runs), |
| 265 | + benchmark_command_str, |
| 266 | + ) |
| 267 | + benchmark_command_str = re.sub( |
| 268 | + "--run-count=\\d+", |
| 269 | + "--run-count={}".format(override_test_runs), |
| 270 | + benchmark_command_str, |
| 271 | + ) |
| 272 | + benchmark_command_str = re.sub( |
| 273 | + '--run-count="\\d+"', |
| 274 | + "--run-count={}".format(override_test_runs), |
| 275 | + benchmark_command_str, |
| 276 | + ) |
| 277 | + # short |
| 278 | + benchmark_command_str = re.sub( |
| 279 | + "-x\\s\\d+", |
| 280 | + "-x={}".format(override_test_runs), |
| 281 | + benchmark_command_str, |
| 282 | + ) |
| 283 | + benchmark_command_str = re.sub( |
| 284 | + "-x=\\d+", |
| 285 | + "-x={}".format(override_test_runs), |
| 286 | + benchmark_command_str, |
| 287 | + ) |
| 288 | + benchmark_command_str = re.sub( |
| 289 | + '-x="\\d+"', |
| 290 | + "-x={}".format(override_test_runs), |
| 291 | + benchmark_command_str, |
| 292 | + ) |
| 293 | + if ( |
| 294 | + len( |
| 295 | + re.findall( |
| 296 | + "--run-count={}".format(override_test_runs), |
| 297 | + benchmark_command_str, |
| 298 | + ) |
| 299 | + ) |
| 300 | + == 0 |
| 301 | + and len( |
| 302 | + re.findall( |
| 303 | + "-x={}".format(override_test_runs), |
| 304 | + benchmark_command_str, |
| 305 | + ) |
| 306 | + ) |
| 307 | + == 0 |
| 308 | + ): |
| 309 | + logging.info("adding --run-count option to benchmark run. ") |
| 310 | + benchmark_command_str = ( |
| 311 | + benchmark_command_str |
| 312 | + + " " |
| 313 | + + "--run-count={}".format(override_test_runs) |
| 314 | + ) |
| 315 | + |
256 | 316 | if override_memtier_test_time > 0:
|
257 | 317 | benchmark_command_str = re.sub(
|
258 | 318 | "--test-time\\s\\d+",
|
@@ -301,14 +361,25 @@ def process_self_contained_coordinator_stream(
|
301 | 361 | dry_run_count = 0
|
302 | 362 | dry_run = args.dry_run
|
303 | 363 | dry_run_include_preload = args.dry_run_include_preload
|
| 364 | + defaults_filename = args.defaults_filename |
| 365 | + override_test_runs = args.override_test_runs |
| 366 | + ( |
| 367 | + _, |
| 368 | + default_metrics, |
| 369 | + _, |
| 370 | + _, |
| 371 | + _, |
| 372 | + ) = get_defaults(defaults_filename) |
| 373 | + |
304 | 374 | for test_file in testsuite_spec_files:
|
| 375 | + if defaults_filename in test_file: |
| 376 | + continue |
305 | 377 | client_containers = []
|
306 | 378 |
|
307 | 379 | with open(test_file, "r") as stream:
|
308 | 380 | _, benchmark_config, test_name = get_final_benchmark_config(
|
309 | 381 | None, stream, ""
|
310 | 382 | )
|
311 |
| - default_metrics = [] |
312 | 383 |
|
313 | 384 | if tls_enabled:
|
314 | 385 | test_name = test_name + "-tls"
|
@@ -511,7 +582,7 @@ def process_self_contained_coordinator_stream(
|
511 | 582 | )
|
512 | 583 |
|
513 | 584 | used_memory_check(
|
514 |
| - benchmark_required_memory, r, "start of benchmark" |
| 585 | + test_name, benchmark_required_memory, r, "start of benchmark" |
515 | 586 | )
|
516 | 587 |
|
517 | 588 | logging.info("Checking if there is a keyspace check being enforced")
|
@@ -582,6 +653,7 @@ def process_self_contained_coordinator_stream(
|
582 | 653 | test_tls_cacert,
|
583 | 654 | resp_version,
|
584 | 655 | override_memtier_test_time,
|
| 656 | + override_test_runs, |
585 | 657 | )
|
586 | 658 |
|
587 | 659 | client_container_image = extract_client_container_image(
|
@@ -652,7 +724,9 @@ def process_self_contained_coordinator_stream(
|
652 | 724 |
|
653 | 725 | logging.info("Printing client tool stdout output")
|
654 | 726 |
|
655 |
| - used_memory_check(benchmark_required_memory, r, "end of benchmark") |
| 727 | + used_memory_check( |
| 728 | + test_name, benchmark_required_memory, r, "end of benchmark" |
| 729 | + ) |
656 | 730 |
|
657 | 731 | if args.flushall_on_every_test_end:
|
658 | 732 | logging.info("Sending FLUSHALL to the DB")
|
@@ -804,14 +878,14 @@ def process_self_contained_coordinator_stream(
|
804 | 878 | )
|
805 | 879 |
|
806 | 880 |
|
807 |
| -def used_memory_check(benchmark_required_memory, r, stage): |
| 881 | +def used_memory_check(test_name, benchmark_required_memory, r, stage): |
808 | 882 | used_memory = r.info("memory")["used_memory"]
|
809 | 883 | used_memory_gb = int(math.ceil(float(used_memory) / 1024.0 / 1024.0 / 1024.0))
|
810 | 884 | logging.info("Benchmark used memory at {}: {}g".format(stage, used_memory_gb))
|
811 | 885 | if used_memory > benchmark_required_memory:
|
812 | 886 | logging.error(
|
813 |
| - "The benchmark specified a dbconfig resource request of memory ({}) bellow the REAL MEMORY USAGE OF: {}. FIX IT!.".format( |
814 |
| - benchmark_required_memory, used_memory_gb |
| 887 | + "The benchmark {} specified a dbconfig resource request of memory ({}) bellow the REAL MEMORY USAGE OF: {}. FIX IT!.".format( |
| 888 | + test_name, benchmark_required_memory, used_memory_gb |
815 | 889 | )
|
816 | 890 | )
|
817 | 891 | exit(1)
|
|
0 commit comments