Skip to content

Commit 58fa73b

Browse files
authored
Merge pull request #2303 from Kobzol/site-queue
Create master benchmark requests in the new system if they are not in the old system
2 parents 313c8d6 + 91e9c5d commit 58fa73b

File tree

2 files changed

+15
-34
lines changed

2 files changed

+15
-34
lines changed

collector/collect-job-queue.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ while : ; do
2424
target/release/collector benchmark_job_queue \
2525
--db "${DATABASE}" \
2626
--check_git_sha \
27-
--git_sha "${CURRENT_SHA}"
27+
--git_sha "${CURRENT_SHA}" \
2828
--collector_name "${COLLECTOR_NAME}"
2929

3030
STATUS=$?

site/src/job_queue/mod.rs

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,8 @@ pub fn is_job_queue_enabled() -> bool {
2121
.unwrap_or(true)
2222
}
2323

24-
/// Should master and release artifacts be automatically inserted into the job queue?
25-
pub fn is_job_queue_insertion_enabled() -> bool {
26-
std::env::var("INSERT_REQUESTS_INTO_JOB_QUEUE")
27-
.ok()
28-
.and_then(|x| x.parse().ok())
29-
.unwrap_or(false)
30-
}
31-
32-
/// rust-lang/rust PR that will be used for testing the job queue.
33-
const TEST_PR_FOR_JOB_QUEUE: u32 = 147039;
34-
35-
pub fn should_use_job_queue(pr: u32) -> bool {
36-
is_job_queue_enabled() && pr == TEST_PR_FOR_JOB_QUEUE
24+
pub fn should_use_job_queue(_pr: u32) -> bool {
25+
is_job_queue_enabled()
3726
}
3827

3928
/// Store the latest master commits or do nothing if all of them are
@@ -55,7 +44,8 @@ async fn create_benchmark_request_master_commits(
5544

5645
let mut inserted = false;
5746
for master_commit in master_commits {
58-
if !index.contains_tag(&master_commit.sha) {
47+
if !index.contains_tag(&master_commit.sha) && conn.pr_of(&master_commit.sha).await.is_none()
48+
{
5949
let pr = master_commit.pr.unwrap_or(0);
6050
let benchmark = BenchmarkRequest::create_master(
6151
&master_commit.sha,
@@ -95,7 +85,7 @@ async fn create_benchmark_request_releases(
9585

9686
let mut inserted = false;
9787
for (name, commit_date) in releases {
98-
if !index.contains_tag(&name) {
88+
if !index.contains_tag(&name) && conn.artifact_by_name(&name).await.is_none() {
9989
let release_request = BenchmarkRequest::create_release(&name, commit_date);
10090
log::info!("Inserting release benchmark request {release_request:?}");
10191

@@ -386,29 +376,20 @@ async fn perform_queue_tick(ctxt: &SiteCtxt) -> anyhow::Result<()> {
386376

387377
let index = ctxt.known_benchmark_requests.load();
388378

389-
let insertion_enabled = is_job_queue_insertion_enabled();
390-
391379
let mut requests_inserted = false;
380+
392381
// Put the master commits into the `benchmark_requests` queue
393-
if insertion_enabled {
394-
match create_benchmark_request_master_commits(ctxt, &*conn, &index).await {
395-
Ok(inserted) => requests_inserted |= inserted,
396-
Err(error) => {
397-
log::error!(
398-
"Could not insert master benchmark requests into the database: {error:?}"
399-
);
400-
}
382+
match create_benchmark_request_master_commits(ctxt, &*conn, &index).await {
383+
Ok(inserted) => requests_inserted |= inserted,
384+
Err(error) => {
385+
log::error!("Could not insert master benchmark requests into the database: {error:?}");
401386
}
402387
}
403388
// Put the releases into the `benchmark_requests` queue
404-
if insertion_enabled {
405-
match create_benchmark_request_releases(&*conn, &index).await {
406-
Ok(inserted) => requests_inserted |= inserted,
407-
Err(error) => {
408-
log::error!(
409-
"Could not insert release benchmark requests into the database: {error:?}"
410-
);
411-
}
389+
match create_benchmark_request_releases(&*conn, &index).await {
390+
Ok(inserted) => requests_inserted |= inserted,
391+
Err(error) => {
392+
log::error!("Could not insert release benchmark requests into the database: {error:?}");
412393
}
413394
}
414395
// Enqueue waiting requests and try to complete in-progress ones

0 commit comments

Comments
 (0)