@@ -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]
@@ -1753,6 +1756,7 @@ where
1753
1756
backend : CodegenBackend ,
1754
1757
profile : Profile ,
1755
1758
benchmark_set : u32 ,
1759
+ kind : BenchmarkJobKind ,
1756
1760
) -> ( bool , anyhow:: Result < u32 > ) {
1757
1761
let row_result = self
1758
1762
. conn ( )
@@ -1764,9 +1768,10 @@ where
1764
1768
backend,
1765
1769
profile,
1766
1770
benchmark_set,
1767
- status
1771
+ status,
1772
+ kind
1768
1773
)
1769
- VALUES ($1, $2, $3, $4, $5, $6)
1774
+ VALUES ($1, $2, $3, $4, $5, $6, $7 )
1770
1775
ON CONFLICT DO NOTHING
1771
1776
RETURNING job_queue.id
1772
1777
"# ,
@@ -1777,6 +1782,7 @@ where
1777
1782
& profile,
1778
1783
& ( benchmark_set as i32 ) ,
1779
1784
& BENCHMARK_JOB_STATUS_QUEUED_STR ,
1785
+ & kind,
1780
1786
] ,
1781
1787
)
1782
1788
. await ;
@@ -1811,6 +1817,7 @@ where
1811
1817
backend : CodegenBackend ,
1812
1818
profile : Profile ,
1813
1819
benchmark_set : u32 ,
1820
+ kind : BenchmarkJobKind ,
1814
1821
) -> anyhow:: Result < Option < u32 > > {
1815
1822
// This will return zero rows if the job already exists
1816
1823
let rows = self
@@ -1823,9 +1830,10 @@ where
1823
1830
backend,
1824
1831
profile,
1825
1832
benchmark_set,
1826
- status
1833
+ status,
1834
+ kind
1827
1835
)
1828
- VALUES ($1, $2, $3, $4, $5, $6)
1836
+ VALUES ($1, $2, $3, $4, $5, $6, $7 )
1829
1837
ON CONFLICT DO NOTHING
1830
1838
RETURNING job_queue.id
1831
1839
"# ,
@@ -1836,6 +1844,7 @@ where
1836
1844
& profile,
1837
1845
& ( benchmark_set as i32 ) ,
1838
1846
& BENCHMARK_JOB_STATUS_QUEUED_STR ,
1847
+ & kind,
1839
1848
] ,
1840
1849
)
1841
1850
. await
@@ -2021,6 +2030,7 @@ where
2021
2030
updated.created_at,
2022
2031
updated.started_at,
2023
2032
updated.retry,
2033
+ updated.kind,
2024
2034
br.commit_type,
2025
2035
br.commit_date
2026
2036
FROM updated
@@ -2054,9 +2064,11 @@ where
2054
2064
collector_name : collector_name. into ( ) ,
2055
2065
} ,
2056
2066
deque_counter : row. get :: < _ , i32 > ( 6 ) as u32 ,
2067
+ kind : BenchmarkJobKind :: from_str ( row. get :: < _ , & str > ( 7 ) )
2068
+ . map_err ( |e| anyhow:: anyhow!( e) ) ?,
2057
2069
} ;
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 ) ;
2060
2072
2061
2073
let commit_date = Date ( commit_date. ok_or_else ( || {
2062
2074
anyhow:: anyhow!( "Dequeuing job for a benchmark request without commit date" )
@@ -2262,6 +2274,8 @@ where
2262
2274
created_at : row. get :: < _ , DateTime < Utc > > ( 6 ) ,
2263
2275
status,
2264
2276
deque_counter : row. get :: < _ , i32 > ( 10 ) as u32 ,
2277
+ kind : BenchmarkJobKind :: from_str ( row. get :: < _ , & str > ( 12 ) )
2278
+ . map_err ( |e| anyhow:: anyhow!( e) ) ?,
2265
2279
} ;
2266
2280
request_to_jobs
2267
2281
. entry ( job. request_tag . clone ( ) )
@@ -2429,6 +2443,7 @@ impl_to_postgresql_via_to_string!(BenchmarkRequestType);
2429
2443
impl_to_postgresql_via_to_string ! ( Target ) ;
2430
2444
impl_to_postgresql_via_to_string ! ( CodegenBackend ) ;
2431
2445
impl_to_postgresql_via_to_string ! ( Profile ) ;
2446
+ impl_to_postgresql_via_to_string ! ( BenchmarkJobKind ) ;
2432
2447
2433
2448
#[ cfg( test) ]
2434
2449
mod tests {
0 commit comments