@@ -302,9 +302,17 @@ pub async fn master_commits() -> anyhow::Result<Vec<MasterCommit>> {
302
302
#[ derive( Default ) ]
303
303
pub struct CollectorStepBuilder {
304
304
steps : Vec < String > ,
305
+ job_id : Option < u32 > ,
305
306
}
306
307
307
308
impl CollectorStepBuilder {
309
+ pub fn new ( job_id : Option < u32 > ) -> Self {
310
+ Self {
311
+ steps : vec ! [ ] ,
312
+ job_id,
313
+ }
314
+ }
315
+
308
316
pub fn record_compile_benchmarks (
309
317
mut self ,
310
318
benchmarks : & [ Benchmark ] ,
@@ -338,9 +346,11 @@ impl CollectorStepBuilder {
338
346
let artifact_row_id = {
339
347
let mut tx = conn. transaction ( ) . await ;
340
348
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
+ }
344
354
tx. commit ( ) . await . unwrap ( ) ;
345
355
artifact_row_id
346
356
} ;
@@ -353,6 +363,7 @@ impl CollectorStepBuilder {
353
363
CollectorCtx {
354
364
artifact_row_id,
355
365
measured_compile_test_cases,
366
+ job_id : self . job_id ,
356
367
}
357
368
}
358
369
}
@@ -362,17 +373,26 @@ pub struct CollectorCtx {
362
373
pub artifact_row_id : ArtifactIdNumber ,
363
374
/// Which tests cases were already computed **before** this collection began?
364
375
pub measured_compile_test_cases : HashSet < CompileTestCase > ,
376
+ pub job_id : Option < u32 > ,
365
377
}
366
378
367
379
impl CollectorCtx {
380
+ pub fn is_from_job_queue ( & self ) -> bool {
381
+ self . job_id . is_some ( )
382
+ }
383
+
368
384
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
+ }
371
389
}
372
390
373
391
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
+ }
376
396
}
377
397
378
398
/// Starts a new runtime benchmark collector step.
@@ -384,14 +404,20 @@ impl CollectorCtx {
384
404
group : & BenchmarkGroup ,
385
405
) -> Option < String > {
386
406
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
+ }
390
414
}
391
415
392
416
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
+ }
395
421
}
396
422
}
397
423
0 commit comments