Skip to content

Commit e921cf5

Browse files
committed
Remove usage of the collector_progress table
1 parent 99c7b6b commit e921cf5

File tree

6 files changed

+2
-164
lines changed

6 files changed

+2
-164
lines changed

collector/src/bin/collector.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,8 +2231,6 @@ async fn bench_compile(
22312231
print_intro: &dyn Fn(),
22322232
measure: F,
22332233
) {
2234-
collector.start_compile_step(conn, benchmark_name).await;
2235-
22362234
let mut tx = conn.transaction().await;
22372235
let (supports_stable, category) = category.db_representation();
22382236
tx.conn()
@@ -2259,7 +2257,6 @@ async fn bench_compile(
22592257
)
22602258
.await;
22612259
};
2262-
collector.end_compile_step(tx.conn(), benchmark_name).await;
22632260
tx.commit().await.expect("committed");
22642261
}
22652262

collector/src/lib.rs

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mod self_profile;
1515
pub mod toolchain;
1616
pub mod utils;
1717

18-
use crate::compile::benchmark::{Benchmark, BenchmarkName};
18+
use crate::compile::benchmark::Benchmark;
1919
use crate::runtime::{BenchmarkGroup, BenchmarkSuite};
2020
pub use crate::self_profile::{
2121
LocalSelfProfileStorage, S3SelfProfileStorage, SelfProfileId, SelfProfileStorage,
@@ -342,17 +342,7 @@ impl CollectorStepBuilder {
342342
) -> CollectorCtx {
343343
// Make sure there is no observable time when the artifact ID is available
344344
// but the in-progress steps are not.
345-
let artifact_row_id = {
346-
let mut tx = conn.transaction().await;
347-
let artifact_row_id = tx.conn().artifact_id(artifact_id).await;
348-
if self.job_id.is_none() {
349-
tx.conn()
350-
.collector_start(artifact_row_id, &self.steps)
351-
.await;
352-
}
353-
tx.commit().await.unwrap();
354-
artifact_row_id
355-
};
345+
let artifact_row_id = conn.artifact_id(artifact_id).await;
356346
// Find out which tests cases were already computed
357347
let measured_compile_test_cases = conn
358348
.get_compile_test_cases_with_measurements(&artifact_row_id)
@@ -385,24 +375,6 @@ pub struct CollectorCtx {
385375
}
386376

387377
impl CollectorCtx {
388-
pub fn is_from_job_queue(&self) -> bool {
389-
self.job_id.is_some()
390-
}
391-
392-
pub async fn start_compile_step(&self, conn: &dyn Connection, benchmark_name: &BenchmarkName) {
393-
if !self.is_from_job_queue() {
394-
conn.collector_start_step(self.artifact_row_id, &benchmark_name.0)
395-
.await;
396-
}
397-
}
398-
399-
pub async fn end_compile_step(&self, conn: &dyn Connection, benchmark_name: &BenchmarkName) {
400-
if !self.is_from_job_queue() {
401-
conn.collector_end_step(self.artifact_row_id, &benchmark_name.0)
402-
.await;
403-
}
404-
}
405-
406378
/// Returns the names of benchmarks in the group that have not yet been measured
407379
/// for the given target.
408380
pub fn get_unmeasured_runtime_benchmarks<'a>(
@@ -422,21 +394,6 @@ impl CollectorCtx {
422394
.map(|s| s.as_str())
423395
.collect()
424396
}
425-
426-
pub async fn start_runtime_step(&self, conn: &dyn Connection, group: &BenchmarkGroup) {
427-
if !self.is_from_job_queue() {
428-
let step_name = runtime_group_step_name(&group.name);
429-
conn.collector_start_step(self.artifact_row_id, &step_name)
430-
.await;
431-
}
432-
}
433-
434-
pub async fn end_runtime_step(&self, conn: &dyn Connection, group: &BenchmarkGroup) {
435-
if !self.is_from_job_queue() {
436-
conn.collector_end_step(self.artifact_row_id, &runtime_group_step_name(&group.name))
437-
.await;
438-
}
439-
}
440397
}
441398

442399
pub fn runtime_group_step_name(benchmark_name: &str) -> String {

collector/src/runtime/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ pub async fn bench_runtime(
8181
}
8282

8383
let step_name = runtime_group_step_name(&group.name);
84-
collector.start_runtime_step(conn, &group).await;
8584

8685
let mut tx = conn.transaction().await;
8786

@@ -136,7 +135,6 @@ pub async fn bench_runtime(
136135
.await;
137136
};
138137

139-
collector.end_runtime_step(tx.conn(), &group).await;
140138
tx.commit()
141139
.await
142140
.expect("Cannot commit runtime benchmark group results");

database/src/pool.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,6 @@ pub trait Connection: Send + Sync {
124124
) -> Vec<Vec<Option<f64>>>;
125125
async fn get_error(&self, artifact_row_id: ArtifactIdNumber) -> HashMap<String, String>;
126126

127-
// Collector status API
128-
129-
// TODO: these functions should be removed. The only useful user of them currently are runtime
130-
// benchmarks, which should switch to something similar to
131-
// `get_compile_test_cases_with_measurements`.
132-
async fn collector_start(&self, aid: ArtifactIdNumber, steps: &[String]);
133-
134-
// Returns `true` if the step was started, i.e., it did not previously have
135-
// an end. Otherwise returns false, indicating that we can skip it.
136-
async fn collector_start_step(&self, aid: ArtifactIdNumber, step: &str) -> bool;
137-
async fn collector_end_step(&self, aid: ArtifactIdNumber, step: &str);
138-
139-
async fn collector_remove_step(&self, aid: ArtifactIdNumber, step: &str);
140-
141127
/// Returns the SHA of the parent of the given SHA commit, if available.
142128
async fn parent_of(&self, sha: &str) -> Option<String>;
143129

database/src/pool/postgres.rs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,60 +1202,6 @@ where
12021202
}
12031203
}
12041204

1205-
async fn collector_start(&self, aid: ArtifactIdNumber, steps: &[String]) {
1206-
// Clean up -- we'll re-insert any missing things in the loop below.
1207-
self.conn()
1208-
.execute(
1209-
"delete from collector_progress where start_time is null or end_time is null;",
1210-
&[],
1211-
)
1212-
.await
1213-
.unwrap();
1214-
1215-
for step in steps {
1216-
self.conn()
1217-
.execute(
1218-
"insert into collector_progress(aid, step) VALUES ($1, $2)
1219-
ON CONFLICT DO NOTHING",
1220-
&[&(aid.0 as i32), &step],
1221-
)
1222-
.await
1223-
.unwrap();
1224-
}
1225-
}
1226-
async fn collector_start_step(&self, aid: ArtifactIdNumber, step: &str) -> bool {
1227-
// If we modified a row, then we populated a start time, so we're good
1228-
// to go. Otherwise we should just skip this step.
1229-
self.conn()
1230-
.execute(
1231-
"update collector_progress set start_time = statement_timestamp() \
1232-
where aid = $1 and step = $2 and start_time is null and end_time is null;",
1233-
&[&(aid.0 as i32), &step],
1234-
)
1235-
.await
1236-
.unwrap()
1237-
== 1
1238-
}
1239-
async fn collector_end_step(&self, aid: ArtifactIdNumber, step: &str) {
1240-
self.conn()
1241-
.execute(
1242-
"update collector_progress set end_time = statement_timestamp() \
1243-
where aid = $1 and step = $2 and start_time is not null;",
1244-
&[&(aid.0 as i32), &step],
1245-
)
1246-
.await
1247-
.unwrap();
1248-
}
1249-
async fn collector_remove_step(&self, aid: ArtifactIdNumber, step: &str) {
1250-
self.conn()
1251-
.execute(
1252-
"delete from collector_progress \
1253-
where aid = $1 and step = $2;",
1254-
&[&(aid.0 as i32), &step],
1255-
)
1256-
.await
1257-
.unwrap();
1258-
}
12591205
async fn parent_of(&self, sha: &str) -> Option<String> {
12601206
self.conn()
12611207
.query_opt(

database/src/pool/sqlite.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -971,52 +971,6 @@ impl Connection for SqliteConnection {
971971
.collect::<Result<_, _>>()
972972
.unwrap()
973973
}
974-
async fn collector_start(&self, aid: ArtifactIdNumber, steps: &[String]) {
975-
// Clean out any leftover unterminated steps.
976-
self.raw_ref()
977-
.execute_batch("delete from collector_progress where start is null or end is null;")
978-
.unwrap();
979-
980-
// Populate unstarted and unfinished steps into collector_progress.
981-
for step in steps {
982-
self.raw_ref()
983-
.execute(
984-
"insert or ignore into collector_progress(aid, step) VALUES (?, ?)",
985-
params![&aid.0, step],
986-
)
987-
.unwrap();
988-
}
989-
}
990-
async fn collector_start_step(&self, aid: ArtifactIdNumber, step: &str) -> bool {
991-
self.raw_ref()
992-
.execute(
993-
"update collector_progress set start = strftime('%s','now') \
994-
where aid = ? and step = ? and start is null and end is null;",
995-
params![&aid.0, &step],
996-
)
997-
.unwrap()
998-
== 1
999-
}
1000-
1001-
async fn collector_end_step(&self, aid: ArtifactIdNumber, step: &str) {
1002-
self.raw_ref()
1003-
.execute(
1004-
"update collector_progress set end = strftime('%s','now') \
1005-
where aid = ? and step = ? and start is not null;",
1006-
params![&aid.0, &step],
1007-
)
1008-
.unwrap();
1009-
}
1010-
1011-
async fn collector_remove_step(&self, aid: ArtifactIdNumber, step: &str) {
1012-
self.raw_ref()
1013-
.execute(
1014-
"delete from collector_progress \
1015-
where aid = ? and step = ?",
1016-
params![&aid.0, &step],
1017-
)
1018-
.unwrap();
1019-
}
1020974

1021975
async fn parent_of(&self, _sha: &str) -> Option<String> {
1022976
None

0 commit comments

Comments
 (0)