Skip to content

Commit f1e4fc7

Browse files
authored
Merge pull request #2304 from Kobzol/new-system-more
Re-enable backfilling
2 parents 58fa73b + 4608937 commit f1e4fc7

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

site/src/job_queue/mod.rs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::job_queue::utils::{parse_release_string, ExtractIf};
55
use crate::load::{partition_in_place, SiteCtxt};
66
use chrono::Utc;
77
use collector::benchmark_set::benchmark_set_count;
8+
use database::pool::Transaction;
89
use database::{
910
BenchmarkJobKind, BenchmarkRequest, BenchmarkRequestIndex, BenchmarkRequestStatus,
1011
BenchmarkRequestType, CodegenBackend, Date, PendingBenchmarkRequests, Profile, QueuedCommit,
@@ -219,15 +220,13 @@ pub async fn enqueue_benchmark_request(
219220
let backends = request.backends()?;
220221
let profiles = request.profiles()?;
221222

222-
// Prevent the error from spamming the logs
223-
// let mut has_emitted_parent_sha_error = false;
224-
225-
let mut enqueue_job_required = async |request_tag,
226-
target,
227-
backend,
228-
profile,
229-
benchmark_set,
230-
kind| {
223+
let enqueue_job_required = async |tx: &mut Box<dyn Transaction>,
224+
request_tag,
225+
target,
226+
backend,
227+
profile,
228+
benchmark_set,
229+
kind| {
231230
let created_job = tx
232231
.conn()
233232
.enqueue_benchmark_job(request_tag, target, backend, profile, benchmark_set, kind)
@@ -246,6 +245,7 @@ pub async fn enqueue_benchmark_request(
246245
for &backend in backends.iter() {
247246
for &profile in profiles.iter() {
248247
enqueue_job_required(
248+
&mut tx,
249249
request_tag,
250250
target,
251251
backend,
@@ -260,43 +260,42 @@ pub async fn enqueue_benchmark_request(
260260
// but was already benchmarked then the collector will ignore
261261
// it as it will see it already has results.
262262

263-
// Do not enqueue parent jobs to allow parallel execution with the old system
264-
// If the parent artifact wouldn't be benchmarked yet, we would benchmark the
265-
// parent with the new system.
266-
// if let Some(parent_sha) = request.parent_sha() {
267-
// let (is_foreign_key_violation, result) = tx
268-
// .conn()
269-
// .enqueue_parent_benchmark_job(
270-
// parent_sha,
271-
// target,
272-
// backend,
273-
// profile,
274-
// benchmark_set as u32,
275-
// BenchmarkJobKind::Compiletime,
276-
// )
277-
// .await;
278-
//
279-
// // At some point in time the parent_sha may not refer
280-
// // to a `benchmark_request` and we want to be able to
281-
// // see that error.
282-
// if let Err(e) = result {
283-
// if is_foreign_key_violation && !has_emitted_parent_sha_error {
284-
// log::error!("Failed to create job for parent sha {e:?}");
285-
// has_emitted_parent_sha_error = true;
286-
// } else if has_emitted_parent_sha_error && is_foreign_key_violation {
287-
// continue;
288-
// } else {
289-
// return Err(e);
290-
// }
291-
// }
292-
// }
263+
if let Some(parent_sha) = request.parent_sha() {
264+
// If the parent is in the old system, do not backfill it
265+
if tx.conn().parent_of(parent_sha).await.is_some() {
266+
continue;
267+
}
268+
let (is_foreign_key_violation, result) = tx
269+
.conn()
270+
.enqueue_parent_benchmark_job(
271+
parent_sha,
272+
target,
273+
backend,
274+
profile,
275+
benchmark_set as u32,
276+
BenchmarkJobKind::Compiletime,
277+
)
278+
.await;
279+
280+
// At some point in time the parent_sha may not refer
281+
// to a `benchmark_request` and we want to be able to
282+
// see that error.
283+
if let Err(e) = result {
284+
if is_foreign_key_violation {
285+
log::error!("Failed to create job for parent sha {e:?}");
286+
} else {
287+
return Err(e);
288+
}
289+
}
290+
}
293291
}
294292
}
295293
}
296294

297295
// Enqueue Runtime job for all targets using LLVM as the backend for
298296
// runtime benchmarks
299297
enqueue_job_required(
298+
&mut tx,
300299
request_tag,
301300
target,
302301
CodegenBackend::Llvm,
@@ -312,6 +311,7 @@ pub async fn enqueue_benchmark_request(
312311
// assumed that if the compilation of other rust project improve then this
313312
// too would improve.
314313
enqueue_job_required(
314+
&mut tx,
315315
request_tag,
316316
Target::X86_64UnknownLinuxGnu,
317317
CodegenBackend::Llvm,

0 commit comments

Comments
 (0)