1
1
use crate :: {
2
- ArtifactCollection , ArtifactId , ArtifactIdNumber , BenchmarkRequest , BenchmarkRequestStatus ,
3
- CodegenBackend , CompileBenchmark , Target ,
2
+ ArtifactCollection , ArtifactId , ArtifactIdNumber , BenchmarkRequest , BenchmarkRequestIndex ,
3
+ BenchmarkRequestStatus , CodegenBackend , CompileBenchmark , Target ,
4
4
} ;
5
5
use crate :: { CollectionId , Index , Profile , QueuedCommit , Scenario , Step } ;
6
6
use chrono:: { DateTime , Utc } ;
@@ -187,18 +187,18 @@ pub trait Connection: Send + Sync {
187
187
benchmark_request : & BenchmarkRequest ,
188
188
) -> anyhow:: Result < ( ) > ;
189
189
190
- /// Gets the benchmark requests matching the status. Optionally provide the
191
- /// number of days from whence to search from
192
- async fn get_benchmark_requests_by_status (
193
- & self ,
194
- statuses : & [ BenchmarkRequestStatus ] ,
195
- ) -> anyhow:: Result < Vec < BenchmarkRequest > > ;
190
+ /// Load all known benchmark request SHAs and all completed benchmark requests.
191
+ async fn load_benchmark_request_index ( & self ) -> anyhow :: Result < BenchmarkRequestIndex > ;
192
+
193
+ /// Load all pending benchmark requests, i.e. those that have artifacts ready, but haven't
194
+ /// been completed yet. Pending statuses are `ArtifactsReady` and `InProgress`.
195
+ async fn load_pending_benchmark_requests ( & self ) -> anyhow:: Result < Vec < BenchmarkRequest > > ;
196
196
197
197
/// Update the status of a `benchmark_request`
198
198
async fn update_benchmark_request_status (
199
199
& mut self ,
200
- benchmark_request : & BenchmarkRequest ,
201
- benchmark_request_status : BenchmarkRequestStatus ,
200
+ request : & BenchmarkRequest ,
201
+ status : BenchmarkRequestStatus ,
202
202
) -> anyhow:: Result < ( ) > ;
203
203
204
204
/// Update a Try commit to have a `sha` and `parent_sha`. Will update the
@@ -420,7 +420,7 @@ mod tests {
420
420
"" ,
421
421
) ;
422
422
423
- let try_benchmark_request = BenchmarkRequest :: create_try (
423
+ let try_benchmark_request = BenchmarkRequest :: create_try_without_artifacts (
424
424
Some ( "b-sha-2" ) ,
425
425
Some ( "parent-sha-2" ) ,
426
426
32 ,
@@ -474,7 +474,7 @@ mod tests {
474
474
"" ,
475
475
) ;
476
476
477
- let try_benchmark_request = BenchmarkRequest :: create_try (
477
+ let try_benchmark_request = BenchmarkRequest :: create_try_without_artifacts (
478
478
Some ( "b-sha-2" ) ,
479
479
Some ( "parent-sha-2" ) ,
480
480
32 ,
@@ -502,7 +502,7 @@ mod tests {
502
502
. unwrap ( ) ;
503
503
504
504
let requests = db
505
- . get_benchmark_requests_by_status ( & [ BenchmarkRequestStatus :: ArtifactsReady ] )
505
+ . load_benchmark_request_index ( & [ BenchmarkRequestStatus :: ArtifactsReady ] )
506
506
. await
507
507
. unwrap ( ) ;
508
508
@@ -545,7 +545,7 @@ mod tests {
545
545
. unwrap ( ) ;
546
546
547
547
let requests = db
548
- . get_benchmark_requests_by_status ( & [ BenchmarkRequestStatus :: InProgress ] )
548
+ . load_benchmark_request_index ( & [ BenchmarkRequestStatus :: InProgress ] )
549
549
. await
550
550
. unwrap ( ) ;
551
551
@@ -566,7 +566,7 @@ mod tests {
566
566
let time = chrono:: DateTime :: from_str ( "2021-09-01T00:00:00.000Z" ) . unwrap ( ) ;
567
567
let pr = 42 ;
568
568
569
- let try_benchmark_request = BenchmarkRequest :: create_try (
569
+ let try_benchmark_request = BenchmarkRequest :: create_try_without_artifacts (
570
570
None ,
571
571
None ,
572
572
pr,
@@ -582,7 +582,7 @@ mod tests {
582
582
. await
583
583
. unwrap ( ) ;
584
584
let requests = db
585
- . get_benchmark_requests_by_status ( & [ BenchmarkRequestStatus :: ArtifactsReady ] )
585
+ . load_benchmark_request_index ( & [ BenchmarkRequestStatus :: ArtifactsReady ] )
586
586
. await
587
587
. unwrap ( ) ;
588
588
@@ -604,7 +604,7 @@ mod tests {
604
604
let time = chrono:: DateTime :: from_str ( "2021-09-01T00:00:00.000Z" ) . unwrap ( ) ;
605
605
let pr = 42 ;
606
606
607
- let completed_try = BenchmarkRequest :: create_try (
607
+ let completed_try = BenchmarkRequest :: create_try_without_artifacts (
608
608
Some ( "sha-2" ) ,
609
609
Some ( "p-sha-1" ) ,
610
610
pr,
@@ -615,7 +615,7 @@ mod tests {
615
615
) ;
616
616
db. insert_benchmark_request ( & completed_try) . await . unwrap ( ) ;
617
617
618
- let try_benchmark_request = BenchmarkRequest :: create_try (
618
+ let try_benchmark_request = BenchmarkRequest :: create_try_without_artifacts (
619
619
None ,
620
620
None ,
621
621
pr,
@@ -638,7 +638,7 @@ mod tests {
638
638
. unwrap ( ) ;
639
639
640
640
let requests = db
641
- . get_benchmark_requests_by_status ( & [
641
+ . load_benchmark_request_index ( & [
642
642
BenchmarkRequestStatus :: WaitingForArtifacts ,
643
643
BenchmarkRequestStatus :: ArtifactsReady ,
644
644
BenchmarkRequestStatus :: InProgress ,
0 commit comments