Skip to content

Commit 6fb5011

Browse files
committed
Separate try benchmark requests for the old and new system and test the new system on a specific PR
1 parent b2f6179 commit 6fb5011

File tree

3 files changed

+70
-60
lines changed

3 files changed

+70
-60
lines changed

site/src/github.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub mod client;
22
pub mod comparison_summary;
33

44
use crate::api::github::Commit;
5-
use crate::job_queue::run_new_queue;
5+
use crate::job_queue::{run_new_queue, should_use_new_system};
66
use crate::load::{MissingReason, SiteCtxt, TryCommit};
77
use chrono::{DateTime, Utc};
88
use serde::Deserialize;
@@ -240,18 +240,16 @@ async fn attach_shas_to_try_benchmark_request(
240240
commit: &TryCommit,
241241
commit_date: DateTime<Utc>,
242242
) {
243-
if run_new_queue() {
244-
if let Err(e) = conn
245-
.attach_shas_to_try_benchmark_request(
246-
pr_number,
247-
&commit.sha,
248-
&commit.parent_sha,
249-
commit_date,
250-
)
251-
.await
252-
{
253-
log::error!("Failed to add shas to try commit: {e:?}");
254-
}
243+
if let Err(e) = conn
244+
.attach_shas_to_try_benchmark_request(
245+
pr_number,
246+
&commit.sha,
247+
&commit.parent_sha,
248+
commit_date,
249+
)
250+
.await
251+
{
252+
log::error!("Failed to add shas to try commit: {e:?}");
255253
}
256254
}
257255

@@ -281,22 +279,24 @@ pub async fn enqueue_shas(
281279
};
282280
let conn = ctxt.conn().await;
283281

284-
attach_shas_to_try_benchmark_request(
285-
&*conn,
286-
pr_number,
287-
&try_commit,
288-
commit_response.commit.committer.date,
289-
)
290-
.await;
291-
292-
let queued = conn
293-
.pr_attach_commit(
282+
let queued = if should_use_new_system(pr_number) {
283+
attach_shas_to_try_benchmark_request(
284+
&*conn,
285+
pr_number,
286+
&try_commit,
287+
commit_response.commit.committer.date,
288+
)
289+
.await;
290+
true
291+
} else {
292+
conn.pr_attach_commit(
294293
pr_number,
295294
&try_commit.sha,
296295
&try_commit.parent_sha,
297296
Some(commit_response.commit.committer.date),
298297
)
299-
.await;
298+
.await
299+
};
300300
if queued {
301301
if !msg.is_empty() {
302302
msg.push('\n');

site/src/job_queue/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ pub fn run_new_queue() -> bool {
2020
.unwrap_or(false)
2121
}
2222

23+
/// rust-lang/rust PR that will be used for testing the new system.
24+
const TEST_PR_FOR_NEW_SYSTEM: u32 = 147039;
25+
26+
pub fn should_use_new_system(pr: u32) -> bool {
27+
run_new_queue() && pr == TEST_PR_FOR_NEW_SYSTEM
28+
}
29+
2330
/// Store the latest master commits or do nothing if all of them are
2431
/// already in the database.
2532
/// Returns `true` if at least one benchmark request was inserted.

site/src/request_handlers/github.rs

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::github::{
33
client, enqueue_shas, parse_homu_comment, rollup_pr_number, unroll_rollup,
44
COMMENT_MARK_TEMPORARY, RUST_REPO_GITHUB_API_URL,
55
};
6-
use crate::job_queue::run_new_queue;
6+
use crate::job_queue::{run_new_queue, should_use_new_system};
77
use crate::load::SiteCtxt;
88

99
use database::BenchmarkRequest;
@@ -84,13 +84,10 @@ async fn record_try_benchmark_request_without_artifacts(
8484
pr: u32,
8585
backends: &str,
8686
) {
87-
// We only want to run this if the new system is running
88-
if run_new_queue() {
89-
let try_request = BenchmarkRequest::create_try_without_artifacts(pr, backends, "");
90-
log::info!("Inserting try benchmark request {try_request:?}");
91-
if let Err(e) = conn.insert_benchmark_request(&try_request).await {
92-
log::error!("Failed to insert try benchmark request: {}", e);
93-
}
87+
let try_request = BenchmarkRequest::create_try_without_artifacts(pr, backends, "");
88+
log::info!("Inserting try benchmark request {try_request:?}");
89+
if let Err(e) = conn.insert_benchmark_request(&try_request).await {
90+
log::error!("Failed to insert try benchmark request: {}", e);
9491
}
9592
}
9693

@@ -120,20 +117,23 @@ async fn handle_rust_timer(
120117
Ok(cmd) => {
121118
let conn = ctxt.conn().await;
122119

123-
record_try_benchmark_request_without_artifacts(
124-
&*conn,
125-
issue.number,
126-
cmd.params.backends.unwrap_or(""),
127-
)
128-
.await;
129-
conn.queue_pr(
130-
issue.number,
131-
cmd.params.include,
132-
cmd.params.exclude,
133-
cmd.params.runs,
134-
cmd.params.backends,
135-
)
136-
.await;
120+
if should_use_new_system(issue.number) {
121+
record_try_benchmark_request_without_artifacts(
122+
&*conn,
123+
issue.number,
124+
cmd.params.backends.unwrap_or(""),
125+
)
126+
.await;
127+
} else {
128+
conn.queue_pr(
129+
issue.number,
130+
cmd.params.include,
131+
cmd.params.exclude,
132+
cmd.params.runs,
133+
cmd.params.backends,
134+
)
135+
.await;
136+
}
137137
format!(
138138
"Awaiting bors try build completion.
139139
@@ -166,20 +166,23 @@ async fn handle_rust_timer(
166166
{
167167
let conn = ctxt.conn().await;
168168
for command in &valid_build_cmds {
169-
record_try_benchmark_request_without_artifacts(
170-
&*conn,
171-
issue.number,
172-
command.params.backends.unwrap_or(""),
173-
)
174-
.await;
175-
conn.queue_pr(
176-
issue.number,
177-
command.params.include,
178-
command.params.exclude,
179-
command.params.runs,
180-
command.params.backends,
181-
)
182-
.await;
169+
if should_use_new_system(issue.number) {
170+
record_try_benchmark_request_without_artifacts(
171+
&*conn,
172+
issue.number,
173+
command.params.backends.unwrap_or(""),
174+
)
175+
.await;
176+
} else {
177+
conn.queue_pr(
178+
issue.number,
179+
command.params.include,
180+
command.params.exclude,
181+
command.params.runs,
182+
command.params.backends,
183+
)
184+
.await;
185+
}
183186
}
184187
}
185188

0 commit comments

Comments
 (0)