@@ -2,13 +2,13 @@ use crate::pool::{Connection, ConnectionManager, ManagedConnection, Transaction}
22use crate :: selector:: CompileTestCase ;
33use crate :: {
44 ArtifactCollection , ArtifactId , ArtifactIdNumber , Benchmark , BenchmarkJob ,
5- BenchmarkJobConclusion , BenchmarkJobStatus , BenchmarkRequest , BenchmarkRequestIndex ,
6- BenchmarkRequestStatus , BenchmarkRequestType , BenchmarkRequestWithErrors , BenchmarkSet ,
7- CodegenBackend , CollectionId , CollectorConfig , Commit , CommitType , CompileBenchmark , Date ,
8- Index , PendingBenchmarkRequests , Profile , QueuedCommit , Scenario , Target ,
9- BENCHMARK_JOB_STATUS_FAILURE_STR , BENCHMARK_JOB_STATUS_IN_PROGRESS_STR ,
10- BENCHMARK_JOB_STATUS_QUEUED_STR , BENCHMARK_JOB_STATUS_SUCCESS_STR ,
11- BENCHMARK_REQUEST_MASTER_STR , BENCHMARK_REQUEST_RELEASE_STR ,
5+ BenchmarkJobConclusion , BenchmarkJobKind , BenchmarkJobStatus , BenchmarkRequest ,
6+ BenchmarkRequestIndex , BenchmarkRequestStatus , BenchmarkRequestType ,
7+ BenchmarkRequestWithErrors , BenchmarkSet , CodegenBackend , CollectionId , CollectorConfig ,
8+ Commit , CommitType , CompileBenchmark , Date , Index , PendingBenchmarkRequests , Profile ,
9+ QueuedCommit , Scenario , Target , BENCHMARK_JOB_STATUS_FAILURE_STR ,
10+ BENCHMARK_JOB_STATUS_IN_PROGRESS_STR , BENCHMARK_JOB_STATUS_QUEUED_STR ,
11+ BENCHMARK_JOB_STATUS_SUCCESS_STR , BENCHMARK_REQUEST_MASTER_STR , BENCHMARK_REQUEST_RELEASE_STR ,
1212 BENCHMARK_REQUEST_STATUS_ARTIFACTS_READY_STR , BENCHMARK_REQUEST_STATUS_COMPLETED_STR ,
1313 BENCHMARK_REQUEST_STATUS_IN_PROGRESS_STR , BENCHMARK_REQUEST_STATUS_WAITING_FOR_ARTIFACTS_STR ,
1414 BENCHMARK_REQUEST_TRY_STR ,
@@ -417,6 +417,9 @@ static MIGRATIONS: &[&str] = &[
417417 r#"
418418 CREATE INDEX benchmark_request_completed_idx ON benchmark_request(completed_at);
419419 "# ,
420+ r#"
421+ ALTER TABLE job_queue ADD COLUMN kind TEXT NOT NULL;
422+ "# ,
420423] ;
421424
422425#[ async_trait:: async_trait]
@@ -1753,6 +1756,7 @@ where
17531756 backend : CodegenBackend ,
17541757 profile : Profile ,
17551758 benchmark_set : u32 ,
1759+ kind : BenchmarkJobKind ,
17561760 ) -> ( bool , anyhow:: Result < u32 > ) {
17571761 let row_result = self
17581762 . conn ( )
@@ -1764,9 +1768,10 @@ where
17641768 backend,
17651769 profile,
17661770 benchmark_set,
1767- status
1771+ status,
1772+ kind
17681773 )
1769- VALUES ($1, $2, $3, $4, $5, $6)
1774+ VALUES ($1, $2, $3, $4, $5, $6, $7 )
17701775 ON CONFLICT DO NOTHING
17711776 RETURNING job_queue.id
17721777 "# ,
@@ -1777,6 +1782,7 @@ where
17771782 & profile,
17781783 & ( benchmark_set as i32 ) ,
17791784 & BENCHMARK_JOB_STATUS_QUEUED_STR ,
1785+ & kind,
17801786 ] ,
17811787 )
17821788 . await ;
@@ -1811,6 +1817,7 @@ where
18111817 backend : CodegenBackend ,
18121818 profile : Profile ,
18131819 benchmark_set : u32 ,
1820+ kind : BenchmarkJobKind ,
18141821 ) -> anyhow:: Result < Option < u32 > > {
18151822 // This will return zero rows if the job already exists
18161823 let rows = self
@@ -1823,9 +1830,10 @@ where
18231830 backend,
18241831 profile,
18251832 benchmark_set,
1826- status
1833+ status,
1834+ kind
18271835 )
1828- VALUES ($1, $2, $3, $4, $5, $6)
1836+ VALUES ($1, $2, $3, $4, $5, $6, $7 )
18291837 ON CONFLICT DO NOTHING
18301838 RETURNING job_queue.id
18311839 "# ,
@@ -1836,6 +1844,7 @@ where
18361844 & profile,
18371845 & ( benchmark_set as i32 ) ,
18381846 & BENCHMARK_JOB_STATUS_QUEUED_STR ,
1847+ & kind,
18391848 ] ,
18401849 )
18411850 . await
@@ -2021,6 +2030,7 @@ where
20212030 updated.created_at,
20222031 updated.started_at,
20232032 updated.retry,
2033+ updated.kind,
20242034 br.commit_type,
20252035 br.commit_date
20262036 FROM updated
@@ -2054,9 +2064,11 @@ where
20542064 collector_name : collector_name. into ( ) ,
20552065 } ,
20562066 deque_counter : row. get :: < _ , i32 > ( 6 ) as u32 ,
2067+ kind : BenchmarkJobKind :: from_str ( row. get :: < _ , & str > ( 7 ) )
2068+ . map_err ( |e| anyhow:: anyhow!( e) ) ?,
20572069 } ;
2058- let commit_type = row. get :: < _ , & str > ( 7 ) ;
2059- let commit_date = row. get :: < _ , Option < DateTime < Utc > > > ( 8 ) ;
2070+ let commit_type = row. get :: < _ , & str > ( 8 ) ;
2071+ let commit_date = row. get :: < _ , Option < DateTime < Utc > > > ( 9 ) ;
20602072
20612073 let commit_date = Date ( commit_date. ok_or_else ( || {
20622074 anyhow:: anyhow!( "Dequeuing job for a benchmark request without commit date" )
@@ -2262,6 +2274,8 @@ where
22622274 created_at : row. get :: < _ , DateTime < Utc > > ( 6 ) ,
22632275 status,
22642276 deque_counter : row. get :: < _ , i32 > ( 10 ) as u32 ,
2277+ kind : BenchmarkJobKind :: from_str ( row. get :: < _ , & str > ( 12 ) )
2278+ . map_err ( |e| anyhow:: anyhow!( e) ) ?,
22652279 } ;
22662280 request_to_jobs
22672281 . entry ( job. request_tag . clone ( ) )
@@ -2429,6 +2443,7 @@ impl_to_postgresql_via_to_string!(BenchmarkRequestType);
24292443impl_to_postgresql_via_to_string ! ( Target ) ;
24302444impl_to_postgresql_via_to_string ! ( CodegenBackend ) ;
24312445impl_to_postgresql_via_to_string ! ( Profile ) ;
2446+ impl_to_postgresql_via_to_string ! ( BenchmarkJobKind ) ;
24322447
24332448#[ cfg( test) ]
24342449mod tests {
0 commit comments