@@ -43,6 +43,7 @@ use task_types::{
43
43
resmoke_config_writer:: { ResmokeConfigActor , ResmokeConfigActorService } ,
44
44
resmoke_tasks:: { GenResmokeConfig , GenResmokeTaskService , GenResmokeTaskServiceImpl } ,
45
45
} ;
46
+ use tokio:: { runtime:: Handle , task:: JoinHandle , time} ;
46
47
use tracing:: { event, Level } ;
47
48
use utils:: fs_service:: FsServiceImpl ;
48
49
@@ -434,6 +435,8 @@ impl GenerateTasksService for GenerateTasksServiceImpl {
434
435
& self ,
435
436
deps : & Dependencies ,
436
437
) -> Result < Arc < Mutex < GenTaskCollection > > > {
438
+ let _monitor = RemainingTaskMonitor :: new ( ) ;
439
+
437
440
let build_variant_list = self . evg_config_service . sort_build_variants_by_required ( ) ;
438
441
let build_variant_map = self . evg_config_service . get_build_variant_map ( ) ;
439
442
let task_map = Arc :: new ( self . evg_config_service . get_task_def_map ( ) ) ;
@@ -533,6 +536,11 @@ impl GenerateTasksService for GenerateTasksServiceImpl {
533
536
handle. await . unwrap ( ) ;
534
537
}
535
538
539
+ event ! (
540
+ Level :: INFO ,
541
+ "Finished creating task definitions for all tasks."
542
+ ) ;
543
+
536
544
Ok ( generated_tasks)
537
545
}
538
546
@@ -762,6 +770,11 @@ impl GenerateTasksService for GenerateTasksServiceImpl {
762
770
}
763
771
}
764
772
773
+ event ! (
774
+ Level :: INFO ,
775
+ "Finished creating build variant definitions containing all the generated tasks."
776
+ ) ;
777
+
765
778
Ok ( generated_build_variants)
766
779
}
767
780
}
@@ -804,6 +817,35 @@ fn lookup_task_name(
804
817
}
805
818
}
806
819
820
+ /// Runs a task that will periodically report the number of active tasks since the monitor was created.
821
+ struct RemainingTaskMonitor {
822
+ handle : JoinHandle < ( ) > ,
823
+ }
824
+
825
+ impl RemainingTaskMonitor {
826
+ pub fn new ( ) -> Self {
827
+ let metrics = Handle :: current ( ) . metrics ( ) ;
828
+ let offset = metrics. num_alive_tasks ( ) + 1 ; // + 1 to include the task spawned below.
829
+ let handle = tokio:: spawn ( async move {
830
+ loop {
831
+ time:: sleep ( time:: Duration :: from_secs ( 60 ) ) . await ;
832
+ event ! (
833
+ Level :: INFO ,
834
+ "Waiting on {} generate tasks to finish..." ,
835
+ Handle :: current( ) . metrics( ) . num_alive_tasks( ) - offset
836
+ ) ;
837
+ }
838
+ } ) ;
839
+
840
+ Self { handle }
841
+ }
842
+ }
843
+ impl Drop for RemainingTaskMonitor {
844
+ fn drop ( & mut self ) {
845
+ self . handle . abort ( ) ;
846
+ }
847
+ }
848
+
807
849
/// Spawn a tokio task to perform the task generation work.
808
850
///
809
851
/// # Arguments
0 commit comments