@@ -957,84 +957,99 @@ fn main_result() -> anyhow::Result<i32> {
957
957
return Ok ( 0 ) ;
958
958
} ;
959
959
960
- let pool = database:: Pool :: open ( & db. db ) ;
961
- let mut rt = build_async_runtime ( ) ;
962
-
963
- let res = match next {
964
- NextArtifact :: Release ( tag) => {
965
- let toolchain = create_toolchain_from_published_version ( & tag, & target_triple) ?;
966
- bench_published_artifact (
967
- rt. block_on ( pool. connection ( ) ) ,
968
- & mut rt,
969
- toolchain,
970
- & benchmark_dirs,
971
- )
960
+ let res = std:: panic:: catch_unwind ( || {
961
+ let pool = database:: Pool :: open ( & db. db ) ;
962
+ let mut rt = build_async_runtime ( ) ;
963
+
964
+ match next {
965
+ NextArtifact :: Release ( tag) => {
966
+ let toolchain =
967
+ create_toolchain_from_published_version ( & tag, & target_triple) ?;
968
+ bench_published_artifact (
969
+ rt. block_on ( pool. connection ( ) ) ,
970
+ & mut rt,
971
+ toolchain,
972
+ & benchmark_dirs,
973
+ )
974
+ }
975
+ NextArtifact :: Commit {
976
+ commit,
977
+ include,
978
+ exclude,
979
+ runs,
980
+ } => {
981
+ let sha = commit. sha . to_string ( ) ;
982
+ let sysroot = Sysroot :: install (
983
+ sha. clone ( ) ,
984
+ & target_triple,
985
+ vec ! [ CodegenBackend :: Llvm ] ,
986
+ )
987
+ . with_context ( || format ! ( "failed to install sysroot for {:?}" , commit) ) ?;
988
+
989
+ let mut benchmarks = get_compile_benchmarks (
990
+ & compile_benchmark_dir,
991
+ include. as_deref ( ) ,
992
+ exclude. as_deref ( ) ,
993
+ None ,
994
+ ) ?;
995
+ benchmarks. retain ( |b| b. category ( ) . is_primary_or_secondary ( ) ) ;
996
+
997
+ let artifact_id = ArtifactId :: Commit ( commit) ;
998
+ let mut conn = rt. block_on ( pool. connection ( ) ) ;
999
+ let toolchain = Toolchain :: from_sysroot ( & sysroot, sha) ;
1000
+
1001
+ let compile_config = CompileBenchmarkConfig {
1002
+ benchmarks,
1003
+ profiles : vec ! [
1004
+ Profile :: Check ,
1005
+ Profile :: Debug ,
1006
+ Profile :: Doc ,
1007
+ Profile :: Opt ,
1008
+ ] ,
1009
+ scenarios : Scenario :: all ( ) ,
1010
+ backends : vec ! [ CodegenBackend :: Llvm ] ,
1011
+ iterations : runs. map ( |v| v as usize ) ,
1012
+ is_self_profile : self_profile. self_profile ,
1013
+ bench_rustc : bench_rustc. bench_rustc ,
1014
+ } ;
1015
+ let runtime_suite = rt. block_on ( load_runtime_benchmarks (
1016
+ conn. as_mut ( ) ,
1017
+ & runtime_benchmark_dir,
1018
+ CargoIsolationMode :: Isolated ,
1019
+ None ,
1020
+ & toolchain,
1021
+ & artifact_id,
1022
+ ) ) ?;
1023
+
1024
+ let runtime_config = RuntimeBenchmarkConfig {
1025
+ runtime_suite,
1026
+ filter : BenchmarkFilter :: keep_all ( ) ,
1027
+ iterations : DEFAULT_RUNTIME_ITERATIONS ,
1028
+ } ;
1029
+ let shared = SharedBenchmarkConfig {
1030
+ artifact_id,
1031
+ toolchain,
1032
+ } ;
1033
+
1034
+ run_benchmarks (
1035
+ & mut rt,
1036
+ conn,
1037
+ shared,
1038
+ Some ( compile_config) ,
1039
+ Some ( runtime_config) ,
1040
+ )
1041
+ }
972
1042
}
973
- NextArtifact :: Commit {
974
- commit,
975
- include,
976
- exclude,
977
- runs,
978
- } => {
979
- let sha = commit. sha . to_string ( ) ;
980
- let sysroot = Sysroot :: install (
981
- sha. clone ( ) ,
982
- & target_triple,
983
- vec ! [ CodegenBackend :: Llvm ] ,
984
- )
985
- . with_context ( || format ! ( "failed to install sysroot for {:?}" , commit) ) ?;
1043
+ } ) ;
1044
+ // We need to send a message to this endpoint even if the collector panics
1045
+ client. post ( format ! ( "{}/perf/onpush" , site_url) ) . send ( ) ?;
986
1046
987
- let mut benchmarks = get_compile_benchmarks (
988
- & compile_benchmark_dir,
989
- include. as_deref ( ) ,
990
- exclude. as_deref ( ) ,
991
- None ,
992
- ) ?;
993
- benchmarks. retain ( |b| b. category ( ) . is_primary_or_secondary ( ) ) ;
994
-
995
- let artifact_id = ArtifactId :: Commit ( commit) ;
996
- let mut conn = rt. block_on ( pool. connection ( ) ) ;
997
- let toolchain = Toolchain :: from_sysroot ( & sysroot, sha) ;
998
-
999
- let compile_config = CompileBenchmarkConfig {
1000
- benchmarks,
1001
- profiles : vec ! [ Profile :: Check , Profile :: Debug , Profile :: Doc , Profile :: Opt ] ,
1002
- scenarios : Scenario :: all ( ) ,
1003
- backends : vec ! [ CodegenBackend :: Llvm ] ,
1004
- iterations : runs. map ( |v| v as usize ) ,
1005
- is_self_profile : self_profile. self_profile ,
1006
- bench_rustc : bench_rustc. bench_rustc ,
1007
- } ;
1008
- let runtime_suite = rt. block_on ( load_runtime_benchmarks (
1009
- conn. as_mut ( ) ,
1010
- & runtime_benchmark_dir,
1011
- CargoIsolationMode :: Isolated ,
1012
- None ,
1013
- & toolchain,
1014
- & artifact_id,
1015
- ) ) ?;
1016
-
1017
- let runtime_config = RuntimeBenchmarkConfig {
1018
- runtime_suite,
1019
- filter : BenchmarkFilter :: keep_all ( ) ,
1020
- iterations : DEFAULT_RUNTIME_ITERATIONS ,
1021
- } ;
1022
- let shared = SharedBenchmarkConfig {
1023
- artifact_id,
1024
- toolchain,
1025
- } ;
1026
-
1027
- run_benchmarks (
1028
- & mut rt,
1029
- conn,
1030
- shared,
1031
- Some ( compile_config) ,
1032
- Some ( runtime_config) ,
1033
- )
1047
+ match res {
1048
+ Ok ( res) => res?,
1049
+ Err ( error) => {
1050
+ log:: error!( "The collector has crashed\n {error:?}" ) ;
1034
1051
}
1035
- } ;
1036
- client. post ( format ! ( "{}/perf/onpush" , site_url) ) . send ( ) ?;
1037
- res?;
1052
+ }
1038
1053
Ok ( 0 )
1039
1054
}
1040
1055
0 commit comments