Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion collector/collect-job-queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ while : ; do
target/release/collector benchmark_job_queue \
--db "${DATABASE}" \
--check_git_sha \
--git_sha "${CURRENT_SHA}"
--git_sha "${CURRENT_SHA}" \
--collector_name "${COLLECTOR_NAME}"

STATUS=$?
Expand Down
47 changes: 14 additions & 33 deletions site/src/job_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,8 @@ pub fn is_job_queue_enabled() -> bool {
.unwrap_or(true)
}

/// Should master and release artifacts be automatically inserted into the job queue?
pub fn is_job_queue_insertion_enabled() -> bool {
std::env::var("INSERT_REQUESTS_INTO_JOB_QUEUE")
.ok()
.and_then(|x| x.parse().ok())
.unwrap_or(false)
}

/// rust-lang/rust PR that will be used for testing the job queue.
const TEST_PR_FOR_JOB_QUEUE: u32 = 147039;

pub fn should_use_job_queue(pr: u32) -> bool {
is_job_queue_enabled() && pr == TEST_PR_FOR_JOB_QUEUE
pub fn should_use_job_queue(_pr: u32) -> bool {
is_job_queue_enabled()
}

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

let mut inserted = false;
for master_commit in master_commits {
if !index.contains_tag(&master_commit.sha) {
if !index.contains_tag(&master_commit.sha) && conn.pr_of(&master_commit.sha).await.is_none()
{
let pr = master_commit.pr.unwrap_or(0);
let benchmark = BenchmarkRequest::create_master(
&master_commit.sha,
Expand Down Expand Up @@ -95,7 +85,7 @@ async fn create_benchmark_request_releases(

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

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

let index = ctxt.known_benchmark_requests.load();

let insertion_enabled = is_job_queue_insertion_enabled();

let mut requests_inserted = false;

// Put the master commits into the `benchmark_requests` queue
if insertion_enabled {
match create_benchmark_request_master_commits(ctxt, &*conn, &index).await {
Ok(inserted) => requests_inserted |= inserted,
Err(error) => {
log::error!(
"Could not insert master benchmark requests into the database: {error:?}"
);
}
match create_benchmark_request_master_commits(ctxt, &*conn, &index).await {
Ok(inserted) => requests_inserted |= inserted,
Err(error) => {
log::error!("Could not insert master benchmark requests into the database: {error:?}");
}
}
// Put the releases into the `benchmark_requests` queue
if insertion_enabled {
match create_benchmark_request_releases(&*conn, &index).await {
Ok(inserted) => requests_inserted |= inserted,
Err(error) => {
log::error!(
"Could not insert release benchmark requests into the database: {error:?}"
);
}
match create_benchmark_request_releases(&*conn, &index).await {
Ok(inserted) => requests_inserted |= inserted,
Err(error) => {
log::error!("Could not insert release benchmark requests into the database: {error:?}");
}
}
// Enqueue waiting requests and try to complete in-progress ones
Expand Down
Loading