5353 get_project_ts_tags ,
5454 get_overall_dashboard_keynames ,
5555 check_ec2_env ,
56+ fetch_file_from_remote_setup ,
5657)
5758from sshtunnel import SSHTunnelForwarder
5859
@@ -362,20 +363,22 @@ def run_remote_command_logic(args):
362363 # after we've created the env, even on error we should always teardown
363364 # in case of some unexpected error we fail the test
364365 try :
365-
366+ _ , _ , testcase_start_time_str = get_start_time_vars ()
367+ logname = "{}_{}.log" .format (test_name , testcase_start_time_str )
366368 (
367369 redis_configuration_parameters ,
368370 dataset_load_timeout_secs ,
369371 ) = extract_redis_dbconfig_parameters (benchmark_config , "dbconfig" )
370372 # setup Redis
371- spin_up_standalone_remote_redis (
373+ full_logfile = spin_up_standalone_remote_redis (
372374 benchmark_config ,
373375 server_public_ip ,
374376 username ,
375377 private_key ,
376378 local_module_file ,
377379 remote_module_file ,
378380 remote_dataset_file ,
381+ logname ,
379382 dirname ,
380383 redis_configuration_parameters ,
381384 dbdir_folder ,
@@ -533,7 +536,7 @@ def run_remote_command_logic(args):
533536
534537 benchmark_start_time = datetime .datetime .now ()
535538 # run the benchmark
536- _ , stdout , _ = run_remote_benchmark (
539+ remote_run_result , stdout , _ = run_remote_benchmark (
537540 client_public_ip ,
538541 username ,
539542 private_key ,
@@ -542,6 +545,30 @@ def run_remote_command_logic(args):
542545 command_str ,
543546 )
544547 benchmark_end_time = datetime .datetime .now ()
548+ if remote_run_result is False :
549+ local_logfile = "{}/{}" .format (dirname , logname )
550+ logging .error (
551+ "The benchmark returned an error exit status. Fetching remote logfile {} into {}" .format (
552+ full_logfile , local_logfile
553+ )
554+ )
555+ fetch_file_from_remote_setup (
556+ client_public_ip ,
557+ username ,
558+ private_key ,
559+ local_logfile ,
560+ full_logfile ,
561+ )
562+ if args .upload_results_s3 :
563+ logging .info (
564+ "Uploading logfile {} to s3. s3 bucket name: {}. s3 bucket path: {}" .format (
565+ local_logfile , s3_bucket_name , s3_bucket_path
566+ )
567+ )
568+ artifacts = [local_logfile ]
569+ upload_artifacts_to_s3 (
570+ artifacts , s3_bucket_name , s3_bucket_path
571+ )
545572 benchmark_duration_seconds = (
546573 benchmark_end_time - benchmark_start_time
547574 ).seconds
0 commit comments