@@ -76,6 +76,7 @@ def prepare_benchmark_parameters(
7676 username = None ,
7777 private_key = None ,
7878 client_ssh_port = None ,
79+ redis_password = None ,
7980):
8081 command_arr = None
8182 command_str = None
@@ -98,6 +99,7 @@ def prepare_benchmark_parameters(
9899 username ,
99100 private_key ,
100101 client_ssh_port ,
102+ redis_password ,
101103 )
102104 # v0.4 spec
103105 elif type (benchmark_config [config_key ]) == dict :
@@ -117,6 +119,7 @@ def prepare_benchmark_parameters(
117119 username ,
118120 private_key ,
119121 client_ssh_port ,
122+ redis_password ,
120123 )
121124 printed_command_str = command_str
122125 printed_command_arr = command_arr
@@ -146,6 +149,7 @@ def prepare_benchmark_parameters_specif_tooling(
146149 username ,
147150 private_key ,
148151 client_ssh_port ,
152+ redis_password = None ,
149153):
150154 if "redis-benchmark" in benchmark_tool :
151155 command_arr , command_str = prepare_redis_benchmark_command (
@@ -192,6 +196,7 @@ def prepare_benchmark_parameters_specif_tooling(
192196 entry ,
193197 current_workdir ,
194198 cluster_api_enabled ,
199+ redis_password ,
195200 )
196201
197202 if "tsbs_" in benchmark_tool :
@@ -252,6 +257,7 @@ def prepare_benchmark_parameters_specif_tooling(
252257 input_data_file ,
253258 isremote ,
254259 cluster_api_enabled ,
260+ redis_password ,
255261 )
256262 if "aibench_" in benchmark_tool :
257263 input_data_file = None
@@ -520,68 +526,74 @@ def run_redis_pre_steps(benchmark_config, r, required_modules):
520526 # In case we have modules we use it's artifact version
521527 # otherwise we use redis version as artifact version
522528 version = "N/A"
529+ # run initialization commands before benchmark starts
530+ logging .info ("Running initialization commands before benchmark starts." )
531+ execute_init_commands_start_time = datetime .datetime .now ()
532+ execute_init_commands (benchmark_config , r )
533+ execute_init_commands_duration_seconds = (
534+ datetime .datetime .now () - execute_init_commands_start_time
535+ ).seconds
536+ logging .info (
537+ "Running initialization commands took {} secs." .format (
538+ execute_init_commands_duration_seconds
539+ )
540+ )
541+ stdout = r .execute_command ("info modules" )
542+ (
543+ module_names ,
544+ artifact_versions ,
545+ ) = extract_module_semver_from_info_modules_cmd (stdout )
546+ if "search" in module_names :
547+ logging .info (
548+ "Detected redisearch module. Ensuring all indices are indexed prior benchmark"
549+ )
550+ search_specific_init (r , module_names )
523551 if required_modules is not None and len (required_modules ) > 0 :
524- stdout = r .execute_command ("info modules" )
525- (
526- module_names ,
527- artifact_versions ,
528- ) = extract_module_semver_from_info_modules_cmd (stdout )
552+
529553 check_required_modules (module_names , required_modules )
530- # run initialization commands before benchmark starts
531- logging .info ("Running initialization commands before benchmark starts." )
532- execute_init_commands_start_time = datetime .datetime .now ()
533- execute_init_commands (benchmark_config , r )
534- execute_init_commands_duration_seconds = (
535- datetime .datetime .now () - execute_init_commands_start_time
536- ).seconds
554+
555+ version = artifact_versions [0 ]
556+ else :
557+ version = r .info ("server" )["redis_version" ]
558+
559+ return version
560+
561+
562+ def search_specific_init (r , module_names ):
563+ if "search" in module_names :
537564 logging .info (
538- "Running initialization commands took {} secs." .format (
539- execute_init_commands_duration_seconds
540- )
565+ "Given redisearch was detected, checking for any index that is still indexing."
541566 )
542- if "search" in module_names :
567+ loading_indices = r .execute_command ("ft._list" )
568+ logging .info ("Detected {} indices." .format (len (loading_indices )))
569+ while len (loading_indices ) > 0 :
543570 logging .info (
544- "Given redisearch was detected, checking for any index that is still indexing."
571+ "There are still {} indices loading. {}" .format (
572+ len (loading_indices ), loading_indices
573+ )
545574 )
546- loading_indices = r .execute_command ("ft._list" )
547- logging .info ("Detected {} indices." .format (len (loading_indices )))
548- while len (loading_indices ) > 0 :
575+ for index_pos , fts_indexname in enumerate (loading_indices , start = 0 ):
576+ if type (fts_indexname ) == bytes :
577+ fts_indexname = fts_indexname .decode ()
578+ ft_info = r .execute_command ("ft.info {}" .format (fts_indexname ))
579+ is_indexing = None
580+ percent_indexed = "0.0"
581+ for arraypos , arrayval in enumerate (ft_info , start = 0 ):
582+ if arrayval == b"percent_indexed" or arrayval == "percent_indexed" :
583+ percent_indexed = ft_info [arraypos + 1 ]
584+ if arrayval == b"indexing" or arrayval == "indexing" :
585+ is_indexing = ft_info [arraypos + 1 ]
586+
549587 logging .info (
550- "There are still {} indices loading. {} " .format (
551- len ( loading_indices ), loading_indices
588+ "indexing= {} ; percent_indexed={}. " .format (
589+ is_indexing , percent_indexed
552590 )
553591 )
554- for index_pos , fts_indexname in enumerate (loading_indices , start = 0 ):
555- if type (fts_indexname ) == bytes :
556- fts_indexname = fts_indexname .decode ()
557- ft_info = r .execute_command ("ft.info {}" .format (fts_indexname ))
558- is_indexing = None
559- percent_indexed = "0.0"
560- for arraypos , arrayval in enumerate (ft_info , start = 0 ):
561- if (
562- arrayval == b"percent_indexed"
563- or arrayval == "percent_indexed"
564- ):
565- percent_indexed = ft_info [arraypos + 1 ]
566- if arrayval == b"indexing" or arrayval == "indexing" :
567- is_indexing = ft_info [arraypos + 1 ]
568-
569- logging .info (
570- "indexing={} ; percent_indexed={}." .format (
571- is_indexing , percent_indexed
572- )
573- )
574- if is_indexing == "0" or is_indexing == b"0" or is_indexing == 0 :
575- loading_indices .pop (index_pos )
592+ if is_indexing == "0" or is_indexing == b"0" or is_indexing == 0 :
593+ loading_indices .pop (index_pos )
576594
577- time .sleep (5 )
578- logging .info ("Loaded all secondary indices." )
579-
580- version = artifact_versions [0 ]
581- else :
582- version = r .info ("server" )["redis_version" ]
583-
584- return version
595+ time .sleep (5 )
596+ logging .info ("Loaded all secondary indices." )
585597
586598
587599def dso_check (dso , local_module_file ):
0 commit comments