@@ -32,7 +32,7 @@ pub fn should_use_new_system(pr: u32) -> bool {
3232/// Returns `true` if at least one benchmark request was inserted.
3333async fn create_benchmark_request_master_commits (
3434 ctxt : & SiteCtxt ,
35- conn : & dyn database:: pool:: Connection ,
35+ _conn : & dyn database:: pool:: Connection ,
3636 index : & BenchmarkRequestIndex ,
3737) -> anyhow:: Result < bool > {
3838 let now = Utc :: now ( ) ;
@@ -47,7 +47,7 @@ async fn create_benchmark_request_master_commits(
4747 // TODO; delete at some point in the future
4848 let cutoff: chrono:: DateTime < Utc > = chrono:: DateTime :: from_str ( "2025-08-27T00:00:00.000Z" ) ?;
4949
50- let mut inserted = false ;
50+ let inserted = false ;
5151 for master_commit in master_commits {
5252 // We don't want to add masses of obsolete data
5353 if master_commit. time >= cutoff && !index. contains_tag ( & master_commit. sha ) {
@@ -59,11 +59,14 @@ async fn create_benchmark_request_master_commits(
5959 master_commit. time ,
6060 ) ;
6161 log:: info!( "Inserting master benchmark request {benchmark:?}" ) ;
62- if let Err ( error) = conn. insert_benchmark_request ( & benchmark) . await {
63- log:: error!( "Failed to insert master benchmark request: {error:?}" ) ;
64- } else {
65- inserted = true ;
66- }
62+
63+ // Do not create benchmark requests on production, to allow running in parallel with
64+ // the old system.
65+ // if let Err(error) = conn.insert_benchmark_request(&benchmark).await {
66+ // log::error!("Failed to insert master benchmark request: {error:?}");
67+ // } else {
68+ // inserted = true;
69+ // }
6770 }
6871 }
6972 Ok ( inserted)
@@ -73,7 +76,7 @@ async fn create_benchmark_request_master_commits(
7376/// already in the database
7477/// Returns `true` if at least one benchmark request was inserted.
7578async fn create_benchmark_request_releases (
76- conn : & dyn database:: pool:: Connection ,
79+ _conn : & dyn database:: pool:: Connection ,
7780 index : & BenchmarkRequestIndex ,
7881) -> anyhow:: Result < bool > {
7982 let releases: String = reqwest:: get ( "https://static.rust-lang.org/manifests.txt" )
@@ -89,16 +92,19 @@ async fn create_benchmark_request_releases(
8992 . filter_map ( parse_release_string)
9093 . take ( 20 ) ;
9194
92- let mut inserted = false ;
95+ let inserted = false ;
9396 for ( name, commit_date) in releases {
9497 if commit_date >= cutoff && !index. contains_tag ( & name) {
9598 let release_request = BenchmarkRequest :: create_release ( & name, commit_date) ;
9699 log:: info!( "Inserting release benchmark request {release_request:?}" ) ;
97- if let Err ( error) = conn. insert_benchmark_request ( & release_request) . await {
98- log:: error!( "Failed to insert release benchmark request: {error}" ) ;
99- } else {
100- inserted = true ;
101- }
100+
101+ // Do not create benchmark requests on production, to allow running in parallel with
102+ // the old system.
103+ // if let Err(error) = conn.insert_benchmark_request(&release_request).await {
104+ // log::error!("Failed to insert release benchmark request: {error}");
105+ // } else {
106+ // inserted = true;
107+ // }
102108 }
103109 }
104110 Ok ( inserted)
@@ -211,18 +217,18 @@ pub async fn build_queue(
211217/// This is performed atomically, in a transaction.
212218pub async fn enqueue_benchmark_request (
213219 conn : & mut dyn database:: pool:: Connection ,
214- benchmark_request : & BenchmarkRequest ,
220+ request : & BenchmarkRequest ,
215221) -> anyhow:: Result < ( ) > {
216222 let mut tx = conn. transaction ( ) . await ;
217223
218- let Some ( request_tag) = benchmark_request . tag ( ) else {
219- panic ! ( "Benchmark request {benchmark_request :?} has no tag" ) ;
224+ let Some ( request_tag) = request . tag ( ) else {
225+ panic ! ( "Benchmark request {request :?} has no tag" ) ;
220226 } ;
221227
222- log:: info!( "Enqueuing jobs for request {benchmark_request :?}" ) ;
228+ log:: info!( "Enqueuing jobs for request {request :?}" ) ;
223229
224- let backends = benchmark_request . backends ( ) ?;
225- let profiles = benchmark_request . profiles ( ) ?;
230+ let backends = request . backends ( ) ?;
231+ let profiles = request . profiles ( ) ?;
226232 // Prevent the error from spamming the logs
227233 let mut has_emitted_parent_sha_error = false ;
228234
@@ -245,32 +251,36 @@ pub async fn enqueue_benchmark_request(
245251 // If the parent job has been deleted from the database
246252 // but was already benchmarked then the collector will ignore
247253 // it as it will see it already has results.
248- if let Some ( parent_sha) = benchmark_request. parent_sha ( ) {
249- let ( is_foreign_key_violation, result) = tx
250- . conn ( )
251- . enqueue_parent_benchmark_job (
252- parent_sha,
253- target,
254- backend,
255- profile,
256- benchmark_set as u32 ,
257- )
258- . await ;
259-
260- // At some point in time the parent_sha may not refer
261- // to a `benchmark_request` and we want to be able to
262- // see that error.
263- if let Err ( e) = result {
264- if is_foreign_key_violation && !has_emitted_parent_sha_error {
265- log:: error!( "Failed to create job for parent sha {e:?}" ) ;
266- has_emitted_parent_sha_error = true ;
267- } else if has_emitted_parent_sha_error && is_foreign_key_violation {
268- continue ;
269- } else {
270- return Err ( e) ;
271- }
272- }
273- }
254+
255+ // Do not enqueue parent jobs to allow parallel execution with the old system
256+ // If the parent artifact wouldn't be benchmarked yet, we would benchmark the
257+ // parent with the new system.
258+ // if let Some(parent_sha) = request.parent_sha() {
259+ // let (is_foreign_key_violation, result) = tx
260+ // .conn()
261+ // .enqueue_parent_benchmark_job(
262+ // parent_sha,
263+ // target,
264+ // backend,
265+ // profile,
266+ // benchmark_set as u32,
267+ // )
268+ // .await;
269+ //
270+ // // At some point in time the parent_sha may not refer
271+ // // to a `benchmark_request` and we want to be able to
272+ // // see that error.
273+ // if let Err(e) = result {
274+ // if is_foreign_key_violation && !has_emitted_parent_sha_error {
275+ // log::error!("Failed to create job for parent sha {e:?}");
276+ // has_emitted_parent_sha_error = true;
277+ // } else if has_emitted_parent_sha_error && is_foreign_key_violation {
278+ // continue;
279+ // } else {
280+ // return Err(e);
281+ // }
282+ // }
283+ // }
274284 }
275285 }
276286 }
@@ -294,12 +304,15 @@ async fn process_benchmark_requests(
294304) -> anyhow:: Result < Vec < BenchmarkRequest > > {
295305 let queue = build_queue ( conn) . await ?;
296306
307+ log:: debug!( "Current queue: {queue:?}" ) ;
308+
297309 let mut completed = vec ! [ ] ;
298310 for request in queue {
299311 match request. status ( ) {
300312 BenchmarkRequestStatus :: InProgress => {
301313 let tag = request. tag ( ) . expect ( "In progress request without a tag" ) ;
302314 if conn. maybe_mark_benchmark_request_as_completed ( tag) . await ? {
315+ log:: info!( "Request {tag} marked as completed" ) ;
303316 completed. push ( request) ;
304317 continue ;
305318 }
@@ -318,8 +331,9 @@ async fn process_benchmark_requests(
318331 Ok ( completed)
319332}
320333
321- /// For queueing jobs, add the jobs you want to queue to this function
322- async fn cron_enqueue_jobs ( ctxt : & SiteCtxt ) -> anyhow:: Result < ( ) > {
334+ /// Creates new benchmark requests, enqueues jobs for ready benchmark requests and
335+ /// finishes completed benchmark requests.
336+ async fn perform_queue_tick ( ctxt : & SiteCtxt ) -> anyhow:: Result < ( ) > {
323337 let mut conn = ctxt. conn ( ) . await ;
324338
325339 let index = ctxt. known_benchmark_requests . load ( ) ;
@@ -394,7 +408,10 @@ async fn cron_enqueue_jobs(ctxt: &SiteCtxt) -> anyhow::Result<()> {
394408}
395409
396410/// Entry point for the cron job that manages the benchmark request and job queue.
397- pub async fn cron_main ( site_ctxt : Arc < RwLock < Option < Arc < SiteCtxt > > > > , run_interval : Duration ) {
411+ pub async fn create_queue_process (
412+ site_ctxt : Arc < RwLock < Option < Arc < SiteCtxt > > > > ,
413+ run_interval : Duration ,
414+ ) {
398415 let mut interval = time:: interval ( run_interval) ;
399416 interval. set_missed_tick_behavior ( MissedTickBehavior :: Delay ) ;
400417
@@ -405,7 +422,7 @@ pub async fn cron_main(site_ctxt: Arc<RwLock<Option<Arc<SiteCtxt>>>>, run_interv
405422 let guard = ctxt. read ( ) ;
406423 guard. as_ref ( ) . cloned ( )
407424 } {
408- match cron_enqueue_jobs ( & ctxt_clone) . await {
425+ match perform_queue_tick ( & ctxt_clone) . await {
409426 Ok ( _) => log:: info!( "Cron job finished" ) ,
410427 Err ( e) => log:: error!( "Cron job failed to execute: {e:?}" ) ,
411428 }
0 commit comments