@@ -2,13 +2,13 @@ use crate::pool::{Connection, ConnectionManager, ManagedConnection, Transaction}
2
2
use crate :: selector:: CompileTestCase ;
3
3
use crate :: {
4
4
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 ,
12
12
BENCHMARK_REQUEST_STATUS_ARTIFACTS_READY_STR , BENCHMARK_REQUEST_STATUS_COMPLETED_STR ,
13
13
BENCHMARK_REQUEST_STATUS_IN_PROGRESS_STR , BENCHMARK_REQUEST_STATUS_WAITING_FOR_ARTIFACTS_STR ,
14
14
BENCHMARK_REQUEST_TRY_STR ,
@@ -417,6 +417,9 @@ static MIGRATIONS: &[&str] = &[
417
417
r#"
418
418
CREATE INDEX benchmark_request_completed_idx ON benchmark_request(completed_at);
419
419
"# ,
420
+ r#"
421
+ ALTER TABLE job_queue ADD COLUMN kind TEXT NOT NULL;
422
+ "# ,
420
423
] ;
421
424
422
425
#[ async_trait:: async_trait]
@@ -1746,6 +1749,7 @@ where
1746
1749
backend : CodegenBackend ,
1747
1750
profile : Profile ,
1748
1751
benchmark_set : u32 ,
1752
+ kind : BenchmarkJobKind ,
1749
1753
) -> ( bool , anyhow:: Result < u32 > ) {
1750
1754
let row_result = self
1751
1755
. conn ( )
@@ -1757,9 +1761,10 @@ where
1757
1761
backend,
1758
1762
profile,
1759
1763
benchmark_set,
1760
- status
1764
+ status,
1765
+ kind
1761
1766
)
1762
- VALUES ($1, $2, $3, $4, $5, $6)
1767
+ VALUES ($1, $2, $3, $4, $5, $6, $7 )
1763
1768
ON CONFLICT DO NOTHING
1764
1769
RETURNING job_queue.id
1765
1770
"# ,
@@ -1770,6 +1775,7 @@ where
1770
1775
& profile,
1771
1776
& ( benchmark_set as i32 ) ,
1772
1777
& BENCHMARK_JOB_STATUS_QUEUED_STR ,
1778
+ & kind,
1773
1779
] ,
1774
1780
)
1775
1781
. await ;
@@ -1804,6 +1810,7 @@ where
1804
1810
backend : CodegenBackend ,
1805
1811
profile : Profile ,
1806
1812
benchmark_set : u32 ,
1813
+ kind : BenchmarkJobKind ,
1807
1814
) -> anyhow:: Result < Option < u32 > > {
1808
1815
// This will return zero rows if the job already exists
1809
1816
let rows = self
@@ -1816,9 +1823,10 @@ where
1816
1823
backend,
1817
1824
profile,
1818
1825
benchmark_set,
1819
- status
1826
+ status,
1827
+ kind
1820
1828
)
1821
- VALUES ($1, $2, $3, $4, $5, $6)
1829
+ VALUES ($1, $2, $3, $4, $5, $6, $7 )
1822
1830
ON CONFLICT DO NOTHING
1823
1831
RETURNING job_queue.id
1824
1832
"# ,
@@ -1829,6 +1837,7 @@ where
1829
1837
& profile,
1830
1838
& ( benchmark_set as i32 ) ,
1831
1839
& BENCHMARK_JOB_STATUS_QUEUED_STR ,
1840
+ & kind,
1832
1841
] ,
1833
1842
)
1834
1843
. await
@@ -2014,6 +2023,7 @@ where
2014
2023
updated.created_at,
2015
2024
updated.started_at,
2016
2025
updated.retry,
2026
+ updated.kind,
2017
2027
br.commit_type,
2018
2028
br.commit_date
2019
2029
FROM updated
@@ -2047,9 +2057,11 @@ where
2047
2057
collector_name : collector_name. into ( ) ,
2048
2058
} ,
2049
2059
deque_counter : row. get :: < _ , i32 > ( 6 ) as u32 ,
2060
+ kind : BenchmarkJobKind :: from_str ( row. get :: < _ , & str > ( 7 ) )
2061
+ . map_err ( |e| anyhow:: anyhow!( e) ) ?,
2050
2062
} ;
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 ) ;
2053
2065
2054
2066
let commit_date = Date ( commit_date. ok_or_else ( || {
2055
2067
anyhow:: anyhow!( "Dequeuing job for a benchmark request without commit date" )
@@ -2255,6 +2267,8 @@ where
2255
2267
created_at : row. get :: < _ , DateTime < Utc > > ( 6 ) ,
2256
2268
status,
2257
2269
deque_counter : row. get :: < _ , i32 > ( 10 ) as u32 ,
2270
+ kind : BenchmarkJobKind :: from_str ( row. get :: < _ , & str > ( 12 ) )
2271
+ . map_err ( |e| anyhow:: anyhow!( e) ) ?,
2258
2272
} ;
2259
2273
request_to_jobs
2260
2274
. entry ( job. request_tag . clone ( ) )
@@ -2422,6 +2436,7 @@ impl_to_postgresql_via_to_string!(BenchmarkRequestType);
2422
2436
impl_to_postgresql_via_to_string ! ( Target ) ;
2423
2437
impl_to_postgresql_via_to_string ! ( CodegenBackend ) ;
2424
2438
impl_to_postgresql_via_to_string ! ( Profile ) ;
2439
+ impl_to_postgresql_via_to_string ! ( BenchmarkJobKind ) ;
2425
2440
2426
2441
#[ cfg( test) ]
2427
2442
mod tests {
0 commit comments