Skip to content

Commit 3b50885

Browse files
committed
Queue ordering - sort by PR then commit_type & updated diagram
1 parent 8f3bd69 commit 3b50885

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

site/src/job_queue.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@ fn sort_benchmark_requests(done: &HashSet<String>, request_queue: &mut [Benchmar
8080
let level = &mut request_queue[finished..][..level_len];
8181
level.sort_unstable_by_key(|bmr| {
8282
(
83+
// Pr number takes priority
84+
*bmr.pr().unwrap_or(&0),
8385
// Order master commits before try commits
8486
match bmr.commit_type {
8587
BenchmarkRequestType::Try { .. } => 1,
8688
BenchmarkRequestType::Master { .. } => 0,
8789
BenchmarkRequestType::Release { .. } => unreachable!(),
8890
},
89-
*bmr.pr().unwrap_or(&0),
9091
bmr.created_at,
9192
)
9293
});
@@ -534,15 +535,15 @@ mod tests {
534535
* | m "rrr" C | -----+-->
535536
* +-----------+ |
536537
* | +---------------+
537-
* +--->| t "yee" R pr1 | 6: a try with a low pr
538+
* +--->| t "yee" R pr1 | 3: a try with a low pr
538539
* +---------------+
539540
* +-----------+
540541
* | m "aaa" C |
541542
* +-----------+
542543
* |
543544
* V
544545
* +----------------+
545-
* | m "mmm" R pr88 | 4: a master commit
546+
* | m "mmm" R pr88 | 6: a master commit
546547
* +----------------+
547548
*
548549
* +-----------+
@@ -551,7 +552,7 @@ mod tests {
551552
* |
552553
* V
553554
* +----------------+
554-
* | m "123" R pr11 | 3: a master commit
555+
* | m "123" R pr11 | 4: a master commit, high pr number
555556
* +----------------+
556557
*
557558
*
@@ -561,12 +562,12 @@ mod tests {
561562
* |
562563
* V
563564
* +----------------+
564-
* | m "foo" R pr77 | 4: a master commit
565+
* | m "foo" R pr77 | 5: a master commit
565566
* +----------------+
566567
* |
567568
* V
568569
* +---------------+
569-
* | t "baz" R pr4 | 7: a try with a higher pr
570+
* | t "baz" R pr4 | 7: a try with a low pr, blocked by parent
570571
* +---------------+
571572
*
572573
* The master commits should take priority, then "yee" followed
@@ -597,7 +598,7 @@ mod tests {
597598

598599
queue_order_matches(
599600
&sorted,
600-
&["t1", "v.1.2.3", "123", "foo", "mmm", "yee", "baz"],
601+
&["t1", "v.1.2.3", "yee", "123", "foo", "mmm", "baz"],
601602
);
602603
Ok(ctx)
603604
})

0 commit comments

Comments
 (0)