@@ -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]
@@ -1746,6 +1749,7 @@ where
17461749 backend : CodegenBackend ,
17471750 profile : Profile ,
17481751 benchmark_set : u32 ,
1752+ kind : BenchmarkJobKind ,
17491753 ) -> ( bool , anyhow:: Result < u32 > ) {
17501754 let row_result = self
17511755 . conn ( )
@@ -1757,9 +1761,10 @@ where
17571761 backend,
17581762 profile,
17591763 benchmark_set,
1760- status
1764+ status,
1765+ kind
17611766 )
1762- VALUES ($1, $2, $3, $4, $5, $6)
1767+ VALUES ($1, $2, $3, $4, $5, $6, $7 )
17631768 ON CONFLICT DO NOTHING
17641769 RETURNING job_queue.id
17651770 "# ,
@@ -1770,6 +1775,7 @@ where
17701775 & profile,
17711776 & ( benchmark_set as i32 ) ,
17721777 & BENCHMARK_JOB_STATUS_QUEUED_STR ,
1778+ & kind,
17731779 ] ,
17741780 )
17751781 . await ;
@@ -1804,6 +1810,7 @@ where
18041810 backend : CodegenBackend ,
18051811 profile : Profile ,
18061812 benchmark_set : u32 ,
1813+ kind : BenchmarkJobKind ,
18071814 ) -> anyhow:: Result < Option < u32 > > {
18081815 // This will return zero rows if the job already exists
18091816 let rows = self
@@ -1816,9 +1823,10 @@ where
18161823 backend,
18171824 profile,
18181825 benchmark_set,
1819- status
1826+ status,
1827+ kind
18201828 )
1821- VALUES ($1, $2, $3, $4, $5, $6)
1829+ VALUES ($1, $2, $3, $4, $5, $6, $7 )
18221830 ON CONFLICT DO NOTHING
18231831 RETURNING job_queue.id
18241832 "# ,
@@ -1829,6 +1837,7 @@ where
18291837 & profile,
18301838 & ( benchmark_set as i32 ) ,
18311839 & BENCHMARK_JOB_STATUS_QUEUED_STR ,
1840+ & kind,
18321841 ] ,
18331842 )
18341843 . await
@@ -2014,6 +2023,7 @@ where
20142023 updated.created_at,
20152024 updated.started_at,
20162025 updated.retry,
2026+ updated.kind,
20172027 br.commit_type,
20182028 br.commit_date
20192029 FROM updated
@@ -2047,9 +2057,11 @@ where
20472057 collector_name : collector_name. into ( ) ,
20482058 } ,
20492059 deque_counter : row. get :: < _ , i32 > ( 6 ) as u32 ,
2060+ kind : BenchmarkJobKind :: from_str ( row. get :: < _ , & str > ( 7 ) )
2061+ . map_err ( |e| anyhow:: anyhow!( e) ) ?,
20502062 } ;
2051- let commit_type = row. get :: < _ , & str > ( 7 ) ;
2052- let commit_date = row. get :: < _ , Option < DateTime < Utc > > > ( 8 ) ;
2063+ let commit_type = row. get :: < _ , & str > ( 8 ) ;
2064+ let commit_date = row. get :: < _ , Option < DateTime < Utc > > > ( 9 ) ;
20532065
20542066 let commit_date = Date ( commit_date. ok_or_else ( || {
20552067 anyhow:: anyhow!( "Dequeuing job for a benchmark request without commit date" )
@@ -2255,6 +2267,8 @@ where
22552267 created_at : row. get :: < _ , DateTime < Utc > > ( 6 ) ,
22562268 status,
22572269 deque_counter : row. get :: < _ , i32 > ( 10 ) as u32 ,
2270+ kind : BenchmarkJobKind :: from_str ( row. get :: < _ , & str > ( 12 ) )
2271+ . map_err ( |e| anyhow:: anyhow!( e) ) ?,
22582272 } ;
22592273 request_to_jobs
22602274 . entry ( job. request_tag . clone ( ) )
@@ -2422,6 +2436,7 @@ impl_to_postgresql_via_to_string!(BenchmarkRequestType);
24222436impl_to_postgresql_via_to_string ! ( Target ) ;
24232437impl_to_postgresql_via_to_string ! ( CodegenBackend ) ;
24242438impl_to_postgresql_via_to_string ! ( Profile ) ;
2439+ impl_to_postgresql_via_to_string ! ( BenchmarkJobKind ) ;
24252440
24262441#[ cfg( test) ]
24272442mod tests {
0 commit comments