@@ -359,6 +359,19 @@ def process_self_contained_coordinator_stream(
359359 resp_version = None ,
360360 override_memtier_test_time = 0 ,
361361):
362+ def delete_temporary_files (
363+ temporary_dir_client , full_result_path , benchmark_tool_global
364+ ):
365+ if preserve_temporary_client_dirs is True :
366+ logging .info (f"Preserving temporary client dir { temporary_dir_client } " )
367+ else :
368+ if "redis-benchmark" in benchmark_tool_global :
369+ if full_result_path is not None :
370+ os .remove (full_result_path )
371+ logging .info ("Removing temporary JSON file" )
372+ shutil .rmtree (temporary_dir_client , ignore_errors = True )
373+ logging .info (f"Removing temporary client dir { temporary_dir_client } " )
374+
362375 overall_result = True
363376 results_matrix = []
364377 total_test_suite_runs = 0
@@ -507,6 +520,11 @@ def process_self_contained_coordinator_stream(
507520 test_name , maxmemory , benchmark_required_memory
508521 )
509522 )
523+ delete_temporary_files (
524+ temporary_dir_client = temporary_dir_client ,
525+ full_result_path = None ,
526+ benchmark_tool_global = benchmark_tool_global ,
527+ )
510528 continue
511529
512530 reset_commandstats (redis_conns )
@@ -543,13 +561,23 @@ def process_self_contained_coordinator_stream(
543561 test_name , priority_upper_limit , priority
544562 )
545563 )
564+ delete_temporary_files (
565+ temporary_dir_client = temporary_dir_client ,
566+ full_result_path = None ,
567+ benchmark_tool_global = benchmark_tool_global ,
568+ )
546569 continue
547570 if priority < priority_lower_limit :
548571 logging .warning (
549572 "Skipping test {} giving the priority limit ({}) is bellow the priority value ({})" .format (
550573 test_name , priority_lower_limit , priority
551574 )
552575 )
576+ delete_temporary_files (
577+ temporary_dir_client = temporary_dir_client ,
578+ full_result_path = None ,
579+ benchmark_tool_global = benchmark_tool_global ,
580+ )
553581 continue
554582 logging .info (
555583 "Test {} priority ({}) is within the priority limit [{},{}]" .format (
@@ -567,10 +595,20 @@ def process_self_contained_coordinator_stream(
567595 test_name
568596 )
569597 )
598+ delete_temporary_files (
599+ temporary_dir_client = temporary_dir_client ,
600+ full_result_path = None ,
601+ benchmark_tool_global = benchmark_tool_global ,
602+ )
570603 continue
571604
572605 if dry_run is True :
573606 dry_run_count = dry_run_count + 1
607+ delete_temporary_files (
608+ temporary_dir_client = temporary_dir_client ,
609+ full_result_path = None ,
610+ benchmark_tool_global = benchmark_tool_global ,
611+ )
574612 continue
575613
576614 if "preload_tool" in benchmark_config ["dbconfig" ]:
@@ -598,6 +636,11 @@ def process_self_contained_coordinator_stream(
598636 logging .warning (
599637 "Skipping this test given preload result was false"
600638 )
639+ delete_temporary_files (
640+ temporary_dir_client = temporary_dir_client ,
641+ full_result_path = None ,
642+ benchmark_tool_global = benchmark_tool_global ,
643+ )
601644 continue
602645 execute_init_commands (
603646 benchmark_config , r , dbconfig_keyname = "dbconfig"
@@ -618,6 +661,11 @@ def process_self_contained_coordinator_stream(
618661
619662 if dry_run_include_preload is True :
620663 dry_run_count = dry_run_count + 1
664+ delete_temporary_files (
665+ temporary_dir_client = temporary_dir_client ,
666+ full_result_path = None ,
667+ benchmark_tool_global = benchmark_tool_global ,
668+ )
621669 continue
622670
623671 benchmark_tool = extract_client_tool (benchmark_config )
@@ -692,6 +740,11 @@ def process_self_contained_coordinator_stream(
692740 logging .warning (
693741 "Forcing skip this test given there is an arbitrary commmand and memtier usage. Check https://github.com/RedisLabs/memtier_benchmark/pull/117 ."
694742 )
743+ delete_temporary_files (
744+ temporary_dir_client = temporary_dir_client ,
745+ full_result_path = None ,
746+ benchmark_tool_global = benchmark_tool_global ,
747+ )
695748 continue
696749
697750 client_container_image = extract_client_container_image (
@@ -899,18 +952,11 @@ def process_self_contained_coordinator_stream(
899952 shutil .copy (full_result_path , dest_fpath )
900953 overall_result &= test_result
901954
902- if preserve_temporary_client_dirs is True :
903- logging .info (
904- f"Preserving temporary client dir { temporary_dir_client } "
905- )
906- else :
907- if "redis-benchmark" in benchmark_tool_global :
908- os .remove (full_result_path )
909- logging .info ("Removing temporary JSON file" )
910- shutil .rmtree (temporary_dir_client , ignore_errors = True )
911- logging .info (
912- f"Removing temporary client dir { temporary_dir_client } "
913- )
955+ delete_temporary_files (
956+ temporary_dir_client = temporary_dir_client ,
957+ full_result_path = full_result_path ,
958+ benchmark_tool_global = benchmark_tool_global ,
959+ )
914960
915961 table_name = "Results for entire test-suite"
916962 results_matrix_headers = [
0 commit comments