1616 post_process_remote_run ,
1717)
1818from redisbench_admin .utils .benchmark_config import extract_benchmark_tool_settings
19- from redisbench_admin .utils .redisgraph_benchmark_go import setup_remote_benchmark_ann
19+ from redisbench_admin .utils .redisgraph_benchmark_go import (
20+ setup_remote_benchmark_ann ,
21+ get_redisbench_admin_remote_path ,
22+ )
2023from redisbench_admin .utils .remote import (
2124 execute_remote_commands ,
2225 fetch_file_from_remote_setup ,
@@ -100,6 +103,34 @@ def run_remote_client_tool(
100103 if benchmark_tool == "redis-benchmark" :
101104 tmp = local_bench_fname
102105 local_bench_fname = "result.csv"
106+ commands = [command_str ]
107+ local_output_artifacts = []
108+ remote_output_artifacts = []
109+ if "ann" in benchmark_tool :
110+ [recv_exit_status , stdout , stderr ] = get_redisbench_admin_remote_path (
111+ client_public_ip , username , private_key , client_ssh_port
112+ )[0 ]
113+ pkg_path = stdout [0 ].strip ()
114+ benchmark_suffix = local_bench_fname [: len (local_bench_fname ) - 5 ]
115+ create_website_path = pkg_path + "/run/ann/pkg/"
116+ logging .info ("Remote create website path: {}" .format (create_website_path ))
117+ website_outputdir = "/tmp/website-{}" .format (benchmark_suffix )
118+ website_outputdir_zip = "/tmp/website-{}.zip" .format (benchmark_suffix )
119+ mkdir_command = "mkdir -p {}" .format (website_outputdir )
120+ create_website_command = (
121+ "cd {} && sudo python3 create_website.py --outputdir {}" .format (
122+ create_website_path , website_outputdir
123+ )
124+ )
125+ zip_website_command = "zip -r {} {}" .format (
126+ website_outputdir_zip , website_outputdir
127+ )
128+ commands .append (mkdir_command )
129+ commands .append (create_website_command )
130+ commands .append (zip_website_command )
131+ local_output_artifacts .append (website_outputdir_zip )
132+ remote_output_artifacts .append (website_outputdir_zip )
133+
103134 benchmark_start_time = datetime .datetime .now ()
104135 # run the benchmark
105136 remote_run_result , stdout , _ = run_remote_benchmark (
@@ -108,7 +139,7 @@ def run_remote_client_tool(
108139 private_key ,
109140 remote_results_file ,
110141 local_bench_fname ,
111- command_str ,
142+ commands ,
112143 client_ssh_port ,
113144 )
114145 benchmark_end_time = datetime .datetime .now ()
@@ -159,40 +190,74 @@ def run_remote_benchmark(
159190 client_public_ip ,
160191 username ,
161192 private_key ,
162- remote_results_file ,
163- local_results_file ,
164- command ,
193+ remote_results_files ,
194+ local_results_files ,
195+ commands ,
165196 ssh_port = 22 ,
166197):
167198 remote_run_result = False
168199 res = execute_remote_commands (
169- client_public_ip , username , private_key , [ command ] , ssh_port
200+ client_public_ip , username , private_key , commands , ssh_port
170201 )
171- recv_exit_status , stdout , stderr = res [0 ]
202+ recv_exit_status , _ , _ = res [0 ]
172203
173204 if recv_exit_status != 0 :
174205 logging .error (
175206 "Exit status of remote command execution {}. Printing stdout and stderr" .format (
176207 recv_exit_status
177208 )
178209 )
179- logging .error ("remote process stdout: {}" .format (stdout ))
180- logging .error ("remote process stderr: {}" .format (stderr ))
210+ stderr , stdout = print_commands_outputs (commands , True , res )
181211 else :
182212 logging .info (
183213 "Remote process exited normally. Exit code {}. Printing stdout." .format (
184214 recv_exit_status
185215 )
186216 )
187- logging .info ("remote process stdout: {}" .format (stdout ))
217+ stderr , stdout = print_commands_outputs (commands , False , res )
218+
188219 logging .info ("Extracting the benchmark results" )
189220 remote_run_result = True
190- if "ycsb" not in command :
191- fetch_file_from_remote_setup (
192- client_public_ip ,
193- username ,
194- private_key ,
195- local_results_file ,
196- remote_results_file ,
197- )
221+ if "ycsb" not in commands [0 ]:
222+ if type (local_results_files ) == str :
223+ local_results_file = local_results_files
224+ remote_results_file = remote_results_files
225+ fetch_file_from_remote_setup (
226+ client_public_ip ,
227+ username ,
228+ private_key ,
229+ local_results_file ,
230+ remote_results_file ,
231+ )
232+ if type (local_results_files ) == list :
233+ assert len (local_results_files ) == len (remote_results_files )
234+ for pos , local_results_file in enumerate (local_results_files ):
235+ remote_results_file = remote_results_files [pos ]
236+ fetch_file_from_remote_setup (
237+ client_public_ip ,
238+ username ,
239+ private_key ,
240+ local_results_file ,
241+ remote_results_file ,
242+ )
198243 return remote_run_result , stdout , stderr
244+
245+
246+ def print_commands_outputs (commands , print_err , res ):
247+ bench_stdout = ""
248+ bench_stderr = ""
249+ for pos , res_tuple in enumerate (res ):
250+ recv_exit_status , stdout , stderr = res_tuple
251+ if pos == 0 :
252+ stderr , stdout = stderr , stdout
253+ logging .info (
254+ "Exit status for command {}: {}" .format (commands [pos ], recv_exit_status )
255+ )
256+ logging .info ("\t remote process stdout:" )
257+ for line in stdout :
258+ print (line .strip ())
259+ if print_err :
260+ logging .error ("\t remote process stderr:" )
261+ for line in stderr :
262+ print (line .strip ())
263+ return bench_stderr , bench_stdout
0 commit comments