@@ -220,6 +220,7 @@ def prepare_memtier_benchmark_parameters(
220220 override_memtier_test_time = 0 ,
221221 override_test_runs = 1 ,
222222):
223+ arbitrary_command = False
223224 benchmark_command = [
224225 full_benchmark_path ,
225226 "--port" ,
@@ -256,7 +257,9 @@ def prepare_memtier_benchmark_parameters(
256257 benchmark_command_str = " " .join (benchmark_command )
257258 if "arguments" in clientconfig :
258259 benchmark_command_str = benchmark_command_str + " " + clientconfig ["arguments" ]
259- logging .info (override_memtier_test_time )
260+
261+ if "--command" in benchmark_command_str :
262+ arbitrary_command = True
260263
261264 if override_test_runs > 1 :
262265 benchmark_command_str = re .sub (
@@ -330,7 +333,7 @@ def prepare_memtier_benchmark_parameters(
330333 benchmark_command_str ,
331334 )
332335
333- return None , benchmark_command_str
336+ return None , benchmark_command_str , arbitrary_command
334337
335338
336339def process_self_contained_coordinator_stream (
@@ -425,13 +428,41 @@ def process_self_contained_coordinator_stream(
425428 ssl_ca_certs = tls_cacert ,
426429 ssl_check_hostname = False ,
427430 )
431+ setup_name = "oss-standalone"
428432 r .ping ()
429433 redis_conns = [r ]
434+ if oss_cluster_api_enabled :
435+ redis_conns = []
436+ logging .info ("updating redis connections from cluster slots" )
437+ slots = r .cluster ("slots" )
438+ for slot in slots :
439+ # Master for slot range represented as nested networking information starts at pos 2
440+ # example: [0, 5460, [b'127.0.0.1', 30001, b'eccd21c2e7e9b7820434080d2e394cb8f2a7eff2', []]]
441+ slot_network_info = slot [2 ]
442+ prefered_endpoint = slot_network_info [0 ]
443+ prefered_port = slot_network_info [1 ]
444+ shard_conn = redis .StrictRedis (
445+ host = prefered_endpoint ,
446+ port = prefered_port ,
447+ password = password ,
448+ ssl = tls_enabled ,
449+ ssl_cert_reqs = ssl_cert_reqs ,
450+ ssl_keyfile = tls_key ,
451+ ssl_certfile = tls_cert ,
452+ ssl_ca_certs = tls_cacert ,
453+ ssl_check_hostname = False ,
454+ )
455+ redis_conns .append (shard_conn )
456+ logging .info (
457+ "There are a total of {} shards" .format (len (redis_conns ))
458+ )
459+ setup_name = "oss-cluster"
460+
430461 redis_pids = []
431- first_redis_pid = r .info ()["process_id" ]
432- redis_pids .append (first_redis_pid )
462+ for conn in redis_conns :
463+ redis_pid = conn .info ()["process_id" ]
464+ redis_pids .append (redis_pid )
433465
434- setup_name = "oss-standalone"
435466 github_actor = f"{ tf_triggering_env } -{ running_platform } "
436467 dso = "redis-server"
437468 profilers_artifacts_matrix = []
@@ -457,12 +488,15 @@ def process_self_contained_coordinator_stream(
457488 )
458489 if args .flushall_on_every_test_start :
459490 logging .info ("Sending FLUSHALL to the DB" )
460- r .flushall ()
491+ for conn in redis_conns :
492+ conn .flushall ()
461493
462494 benchmark_required_memory = get_benchmark_required_memory (
463495 benchmark_config
464496 )
465- maxmemory = get_maxmemory (r )
497+ maxmemory = 0
498+ for conn in redis_conns :
499+ maxmemory = maxmemory + get_maxmemory (conn )
466500 if benchmark_required_memory > maxmemory :
467501 logging .warning (
468502 "Skipping test {} given maxmemory of server is bellow the benchmark required memory: {} < {}" .format (
@@ -536,7 +570,7 @@ def process_self_contained_coordinator_stream(
536570 continue
537571
538572 if "preload_tool" in benchmark_config ["dbconfig" ]:
539- data_prepopulation_step (
573+ res = data_prepopulation_step (
540574 benchmark_config ,
541575 benchmark_tool_workdir ,
542576 client_cpuset_cpus ,
@@ -556,12 +590,20 @@ def process_self_contained_coordinator_stream(
556590 password ,
557591 oss_cluster_api_enabled ,
558592 )
593+ if res is False :
594+ logging .warning (
595+ "Skipping this test given preload result was false"
596+ )
597+ continue
559598 execute_init_commands (
560599 benchmark_config , r , dbconfig_keyname = "dbconfig"
561600 )
562601
563602 used_memory_check (
564- test_name , benchmark_required_memory , r , "start of benchmark"
603+ test_name ,
604+ benchmark_required_memory ,
605+ redis_conns ,
606+ "start of benchmark" ,
565607 )
566608
567609 logging .info ("Checking if there is a keyspace check being enforced" )
@@ -598,6 +640,7 @@ def process_self_contained_coordinator_stream(
598640 local_benchmark_output_filename
599641 )
600642 )
643+ arbitrary_command = False
601644
602645 if "memtier_benchmark" not in benchmark_tool :
603646 # prepare the benchmark command
@@ -618,6 +661,7 @@ def process_self_contained_coordinator_stream(
618661 (
619662 _ ,
620663 benchmark_command_str ,
664+ arbitrary_command ,
621665 ) = prepare_memtier_benchmark_parameters (
622666 benchmark_config ["clientconfig" ],
623667 full_benchmark_path ,
@@ -636,6 +680,16 @@ def process_self_contained_coordinator_stream(
636680 override_test_runs ,
637681 )
638682
683+ if (
684+ arbitrary_command
685+ and oss_cluster_api_enabled
686+ and "memtier" in benchmark_tool
687+ ):
688+ logging .warning (
689+ "Forcing skip this test given there is an arbitrary commmand and memtier usage. Check https://github.com/RedisLabs/memtier_benchmark/pull/117 ."
690+ )
691+ continue
692+
639693 client_container_image = extract_client_container_image (
640694 benchmark_config
641695 )
@@ -727,12 +781,16 @@ def process_self_contained_coordinator_stream(
727781 logging .info ("Printing client tool stdout output" )
728782
729783 used_memory_check (
730- test_name , benchmark_required_memory , r , "end of benchmark"
784+ test_name ,
785+ benchmark_required_memory ,
786+ redis_conns ,
787+ "end of benchmark" ,
731788 )
732789
733790 if args .flushall_on_every_test_end :
734791 logging .info ("Sending FLUSHALL to the DB" )
735- r .flushall ()
792+ for r in redis_conns :
793+ r .flushall ()
736794 datapoint_time_ms = start_time_ms
737795
738796 post_process_benchmark_results (
@@ -909,8 +967,10 @@ def get_benchmark_required_memory(benchmark_config):
909967 return benchmark_required_memory
910968
911969
912- def used_memory_check (test_name , benchmark_required_memory , r , stage ):
913- used_memory = r .info ("memory" )["used_memory" ]
970+ def used_memory_check (test_name , benchmark_required_memory , redis_conns , stage ):
971+ used_memory = 0
972+ for conn in redis_conns :
973+ used_memory = used_memory + conn .info ("memory" )["used_memory" ]
914974 used_memory_gb = int (math .ceil (float (used_memory ) / 1024.0 / 1024.0 / 1024.0 ))
915975 logging .info ("Benchmark used memory at {}: {}g" .format (stage , used_memory_gb ))
916976 if used_memory > benchmark_required_memory :
@@ -998,6 +1058,7 @@ def data_prepopulation_step(
9981058 password = None ,
9991059 oss_cluster_api_enabled = False ,
10001060):
1061+ result = True
10011062 # setup the benchmark
10021063 (
10031064 start_time ,
@@ -1019,7 +1080,11 @@ def data_prepopulation_step(
10191080
10201081 if "memtier_benchmark" in preload_tool :
10211082 override_memtier_test_time_preload = 0
1022- (_ , preload_command_str ,) = prepare_memtier_benchmark_parameters (
1083+ (
1084+ _ ,
1085+ preload_command_str ,
1086+ arbitrary_command ,
1087+ ) = prepare_memtier_benchmark_parameters (
10231088 benchmark_config ["dbconfig" ]["preload_tool" ],
10241089 full_benchmark_path ,
10251090 port ,
@@ -1035,6 +1100,12 @@ def data_prepopulation_step(
10351100 resp_version ,
10361101 override_memtier_test_time_preload ,
10371102 )
1103+ if arbitrary_command is True and oss_cluster_api_enabled :
1104+ logging .warning (
1105+ "Skipping this test given it implies arbitrary command on an cluster setup. Not supported on memtier: https://github.com/RedisLabs/memtier_benchmark/pull/117"
1106+ )
1107+ result = False
1108+ return result
10381109
10391110 # run the benchmark
10401111 preload_start_time = datetime .datetime .now ()
@@ -1093,6 +1164,7 @@ def data_prepopulation_step(
10931164 client_container_stdout ,
10941165 )
10951166 )
1167+ return result
10961168
10971169
10981170def generate_cpuset_cpus (ceil_db_cpu_limit , current_cpu_pos ):
0 commit comments