@@ -302,9 +302,17 @@ pub async fn master_commits() -> anyhow::Result<Vec<MasterCommit>> {
302302#[ derive( Default ) ]
303303pub struct CollectorStepBuilder {
304304 steps : Vec < String > ,
305+ job_id : Option < u32 > ,
305306}
306307
307308impl CollectorStepBuilder {
309+ pub fn new ( job_id : Option < u32 > ) -> Self {
310+ Self {
311+ steps : vec ! [ ] ,
312+ job_id,
313+ }
314+ }
315+
308316 pub fn record_compile_benchmarks (
309317 mut self ,
310318 benchmarks : & [ Benchmark ] ,
@@ -338,9 +346,11 @@ impl CollectorStepBuilder {
338346 let artifact_row_id = {
339347 let mut tx = conn. transaction ( ) . await ;
340348 let artifact_row_id = tx. conn ( ) . artifact_id ( artifact_id) . await ;
341- tx. conn ( )
342- . collector_start ( artifact_row_id, & self . steps )
343- . await ;
349+ if self . job_id . is_none ( ) {
350+ tx. conn ( )
351+ . collector_start ( artifact_row_id, & self . steps )
352+ . await ;
353+ }
344354 tx. commit ( ) . await . unwrap ( ) ;
345355 artifact_row_id
346356 } ;
@@ -353,6 +363,7 @@ impl CollectorStepBuilder {
353363 CollectorCtx {
354364 artifact_row_id,
355365 measured_compile_test_cases,
366+ job_id : self . job_id ,
356367 }
357368 }
358369}
@@ -362,17 +373,26 @@ pub struct CollectorCtx {
362373 pub artifact_row_id : ArtifactIdNumber ,
363374 /// Which tests cases were already computed **before** this collection began?
364375 pub measured_compile_test_cases : HashSet < CompileTestCase > ,
376+ pub job_id : Option < u32 > ,
365377}
366378
367379impl CollectorCtx {
380+ pub fn is_from_job_queue ( & self ) -> bool {
381+ self . job_id . is_some ( )
382+ }
383+
368384 pub async fn start_compile_step ( & self , conn : & dyn Connection , benchmark_name : & BenchmarkName ) {
369- conn. collector_start_step ( self . artifact_row_id , & benchmark_name. 0 )
370- . await ;
385+ if !self . is_from_job_queue ( ) {
386+ conn. collector_start_step ( self . artifact_row_id , & benchmark_name. 0 )
387+ . await ;
388+ }
371389 }
372390
373391 pub async fn end_compile_step ( & self , conn : & dyn Connection , benchmark_name : & BenchmarkName ) {
374- conn. collector_end_step ( self . artifact_row_id , & benchmark_name. 0 )
375- . await
392+ if !self . is_from_job_queue ( ) {
393+ conn. collector_end_step ( self . artifact_row_id , & benchmark_name. 0 )
394+ . await ;
395+ }
376396 }
377397
378398 /// Starts a new runtime benchmark collector step.
@@ -384,14 +404,20 @@ impl CollectorCtx {
384404 group : & BenchmarkGroup ,
385405 ) -> Option < String > {
386406 let step_name = runtime_group_step_name ( & group. name ) ;
387- conn. collector_start_step ( self . artifact_row_id , & step_name)
388- . await
389- . then_some ( step_name)
407+ if self . is_from_job_queue ( ) {
408+ Some ( step_name)
409+ } else {
410+ conn. collector_start_step ( self . artifact_row_id , & step_name)
411+ . await
412+ . then_some ( step_name)
413+ }
390414 }
391415
392416 pub async fn end_runtime_step ( & self , conn : & dyn Connection , group : & BenchmarkGroup ) {
393- conn. collector_end_step ( self . artifact_row_id , & runtime_group_step_name ( & group. name ) )
394- . await
417+ if !self . is_from_job_queue ( ) {
418+ conn. collector_end_step ( self . artifact_row_id , & runtime_group_step_name ( & group. name ) )
419+ . await ;
420+ }
395421 }
396422}
397423
0 commit comments