@@ -768,52 +768,30 @@ def run_remote_command_logic(args, project_name, project_version):
768768                                                tf_github_branch , artifact_version 
769769                                            )
770770                                        ):
771-                                             (
772-                                                 end_time_ms ,
773-                                                 _ ,
774-                                                 overall_end_time_metrics ,
775-                                             ) =  collect_redis_metrics (
776-                                                 redis_conns ,
777-                                                 ["memory" ],
778-                                                 {
779-                                                     "memory" : [
780-                                                         "used_memory" ,
781-                                                         "used_memory_dataset" ,
782-                                                     ]
783-                                                 },
784-                                             )
785-                                             if  total_shards_cpu_usage  is  not   None :
786-                                                 overall_end_time_metrics [
787-                                                     "total_shards_used_cpu_pct" 
788-                                                 ] =  total_shards_cpu_usage 
789-                                             expire_ms  =  7  *  24  *  60  *  60  *  1000 
790-                                             export_redis_metrics (
791-                                                 artifact_version ,
792-                                                 end_time_ms ,
793-                                                 overall_end_time_metrics ,
794-                                                 rts ,
795-                                                 setup_name ,
796-                                                 setup_type ,
797-                                                 test_name ,
798-                                                 tf_github_branch ,
799-                                                 tf_github_org ,
800-                                                 tf_github_repo ,
801-                                                 tf_triggering_env ,
802-                                                 {"metric-type" : "redis-metrics" },
803-                                                 expire_ms ,
804-                                             )
805-                                             if  collect_commandstats :
771+                                             try :
806772                                                (
807773                                                    end_time_ms ,
808774                                                    _ ,
809-                                                     overall_commandstats_metrics ,
775+                                                     overall_end_time_metrics ,
810776                                                ) =  collect_redis_metrics (
811-                                                     redis_conns , ["commandstats" ]
777+                                                     redis_conns ,
778+                                                     ["memory" ],
779+                                                     {
780+                                                         "memory" : [
781+                                                             "used_memory" ,
782+                                                             "used_memory_dataset" ,
783+                                                         ]
784+                                                     },
812785                                                )
786+                                                 if  total_shards_cpu_usage  is  not   None :
787+                                                     overall_end_time_metrics [
788+                                                         "total_shards_used_cpu_pct" 
789+                                                     ] =  total_shards_cpu_usage 
790+                                                 expire_ms  =  7  *  24  *  60  *  60  *  1000 
813791                                                export_redis_metrics (
814792                                                    artifact_version ,
815793                                                    end_time_ms ,
816-                                                     overall_commandstats_metrics ,
794+                                                     overall_end_time_metrics ,
817795                                                    rts ,
818796                                                    setup_name ,
819797                                                    setup_type ,
@@ -822,30 +800,71 @@ def run_remote_command_logic(args, project_name, project_version):
822800                                                    tf_github_org ,
823801                                                    tf_github_repo ,
824802                                                    tf_triggering_env ,
825-                                                     {"metric-type" : "commandstats " },
803+                                                     {"metric-type" : "redis-metrics " },
826804                                                    expire_ms ,
827805                                                )
828-                                                 (
829-                                                     end_time_ms ,
830-                                                     _ ,
831-                                                     overall_commandstats_metrics ,
832-                                                 ) =  collect_redis_metrics (
833-                                                     redis_conns , ["latencystats" ]
806+                                                 if  collect_commandstats :
807+                                                     (
808+                                                         end_time_ms ,
809+                                                         _ ,
810+                                                         overall_commandstats_metrics ,
811+                                                     ) =  collect_redis_metrics (
812+                                                         redis_conns , ["commandstats" ]
813+                                                     )
814+                                                     export_redis_metrics (
815+                                                         artifact_version ,
816+                                                         end_time_ms ,
817+                                                         overall_commandstats_metrics ,
818+                                                         rts ,
819+                                                         setup_name ,
820+                                                         setup_type ,
821+                                                         test_name ,
822+                                                         tf_github_branch ,
823+                                                         tf_github_org ,
824+                                                         tf_github_repo ,
825+                                                         tf_triggering_env ,
826+                                                         {"metric-type" : "commandstats" },
827+                                                         expire_ms ,
828+                                                     )
829+                                                     (
830+                                                         end_time_ms ,
831+                                                         _ ,
832+                                                         overall_commandstats_metrics ,
833+                                                     ) =  collect_redis_metrics (
834+                                                         redis_conns , ["latencystats" ]
835+                                                     )
836+                                                     export_redis_metrics (
837+                                                         artifact_version ,
838+                                                         end_time_ms ,
839+                                                         overall_commandstats_metrics ,
840+                                                         rts ,
841+                                                         setup_name ,
842+                                                         setup_type ,
843+                                                         test_name ,
844+                                                         tf_github_branch ,
845+                                                         tf_github_org ,
846+                                                         tf_github_repo ,
847+                                                         tf_triggering_env ,
848+                                                         {"metric-type" : "latencystats" },
849+                                                         expire_ms ,
850+                                                     )
851+                                             except  redis .exceptions .ConnectionError  as  e :
852+                                                 db_error_artifacts (
853+                                                     db_ssh_port ,
854+                                                     dirname ,
855+                                                     full_logfiles ,
856+                                                     logname ,
857+                                                     private_key ,
858+                                                     s3_bucket_name ,
859+                                                     s3_bucket_path ,
860+                                                     server_public_ip ,
861+                                                     temporary_dir ,
862+                                                     args .upload_results_s3 ,
863+                                                     username ,
834864                                                )
835-                                                 export_redis_metrics (
836-                                                     artifact_version ,
837-                                                     end_time_ms ,
838-                                                     overall_commandstats_metrics ,
839-                                                     rts ,
840-                                                     setup_name ,
841-                                                     setup_type ,
842-                                                     test_name ,
843-                                                     tf_github_branch ,
844-                                                     tf_github_org ,
845-                                                     tf_github_repo ,
846-                                                     tf_triggering_env ,
847-                                                     {"metric-type" : "latencystats" },
848-                                                     expire_ms ,
865+                                                 return_code  |=  1 
866+                                                 raise  Exception (
867+                                                     "Failed to run remote benchmark." 
849868                                                )
850869
851870                                        if  setup_details ["env" ] is  None :
0 commit comments