Skip to content

Commit f068b34

Browse files
committed
Fix; Skip adding a parent_sha if the parent_sha has not been benchmarked ever
1 parent 76103e9 commit f068b34

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

database/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ impl BenchmarkRequest {
10361036
}
10371037

10381038
pub fn is_in_progress(&self) -> bool {
1039-
matches!(self.status, BenchmarkRequestStatus::InProgress { .. })
1039+
matches!(self.status, BenchmarkRequestStatus::InProgress)
10401040
}
10411041
}
10421042

site/src/job_queue/mod.rs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ pub async fn build_queue(
205205
pub async fn enqueue_benchmark_request(
206206
conn: &mut dyn database::pool::Connection,
207207
benchmark_request: &BenchmarkRequest,
208+
index: &BenchmarkRequestIndex,
208209
) -> anyhow::Result<()> {
209210
let mut tx = conn.transaction().await;
210211

@@ -216,6 +217,8 @@ pub async fn enqueue_benchmark_request(
216217

217218
let backends = benchmark_request.backends()?;
218219
let profiles = benchmark_request.profiles()?;
220+
// Prevent the error from spamming the logs
221+
let mut has_emitted_parent_sha_error = false;
219222

220223
// Target x benchmark_set x backend x profile -> BenchmarkJob
221224
for target in Target::all() {
@@ -237,15 +240,22 @@ pub async fn enqueue_benchmark_request(
237240
// but was already benchmarked then the collector will ignore
238241
// it as it will see it already has results.
239242
if let Some(parent_sha) = benchmark_request.parent_sha() {
240-
tx.conn()
241-
.enqueue_benchmark_job(
242-
parent_sha,
243-
target,
244-
backend,
245-
profile,
246-
benchmark_set as u32,
247-
)
248-
.await?;
243+
if !has_emitted_parent_sha_error && !index.contains_tag(parent_sha) {
244+
log::error!("Parent tag; {parent_sha} does not exist in request benchmarks. Skipping");
245+
has_emitted_parent_sha_error = true;
246+
}
247+
248+
if !has_emitted_parent_sha_error {
249+
tx.conn()
250+
.enqueue_benchmark_job(
251+
parent_sha,
252+
target,
253+
backend,
254+
profile,
255+
benchmark_set as u32,
256+
)
257+
.await?;
258+
}
249259
}
250260
}
251261
}
@@ -267,6 +277,7 @@ pub async fn enqueue_benchmark_request(
267277
/// Returns benchmark requests that were completed.
268278
async fn process_benchmark_requests(
269279
conn: &mut dyn database::pool::Connection,
280+
index: &BenchmarkRequestIndex,
270281
) -> anyhow::Result<Vec<BenchmarkRequest>> {
271282
let queue = build_queue(conn).await?;
272283

@@ -282,7 +293,7 @@ async fn process_benchmark_requests(
282293
break;
283294
}
284295
BenchmarkRequestStatus::ArtifactsReady => {
285-
enqueue_benchmark_request(conn, &request).await?;
296+
enqueue_benchmark_request(conn, &request, index).await?;
286297
break;
287298
}
288299
BenchmarkRequestStatus::WaitingForArtifacts
@@ -306,7 +317,7 @@ async fn cron_enqueue_jobs(ctxt: &SiteCtxt) -> anyhow::Result<()> {
306317
// Put the releases into the `benchmark_requests` queue
307318
requests_inserted |= create_benchmark_request_releases(&*conn, &index).await?;
308319
// Enqueue waiting requests and try to complete in-progress ones
309-
let completed_reqs = process_benchmark_requests(&mut *conn).await?;
320+
let completed_reqs = process_benchmark_requests(&mut *conn, &index).await?;
310321

311322
// If some change happened, reload the benchmark request index
312323
if requests_inserted {

0 commit comments

Comments
 (0)