Skip to content

Commit a6091d2

Browse files
committed
Remove --purge=failed
It was not trivial to implement in the new scheme. The previous implementation was rather coarse-grained anyway.
1 parent e921cf5 commit a6091d2

File tree

1 file changed

+7
-33
lines changed

1 file changed

+7
-33
lines changed

collector/src/bin/collector.rs

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -444,19 +444,11 @@ struct BenchRustcOption {
444444
bench_rustc: bool,
445445
}
446446

447-
#[derive(Clone, Debug, clap::ValueEnum)]
448-
enum PurgeMode {
449-
/// Purge all old data associated with the artifact
450-
Old,
451-
/// Purge old data of failed benchmarks associated with the artifact
452-
Failed,
453-
}
454-
455447
#[derive(Debug, clap::Args)]
456448
struct PurgeOption {
457449
/// Removes old data for the specified artifact prior to running the benchmarks.
458450
#[arg(long = "purge")]
459-
purge: Option<PurgeMode>,
451+
purge: bool,
460452
}
461453

462454
#[derive(Debug, clap::Args)]
@@ -872,7 +864,9 @@ fn main_result() -> anyhow::Result<i32> {
872864
r#type: CommitType::Master,
873865
});
874866

875-
rt.block_on(purge_old_data(conn.as_mut(), &artifact_id, purge.purge));
867+
if purge.purge {
868+
rt.block_on(conn.purge_artifact(&artifact_id));
869+
}
876870

877871
let runtime_suite = rt.block_on(load_runtime_benchmarks(
878872
conn.as_mut(),
@@ -1028,7 +1022,9 @@ fn main_result() -> anyhow::Result<i32> {
10281022

10291023
let rt = build_async_runtime();
10301024
let mut conn = rt.block_on(pool.connection());
1031-
rt.block_on(purge_old_data(conn.as_mut(), &artifact_id, purge.purge));
1025+
if purge.purge {
1026+
rt.block_on(conn.purge_artifact(&artifact_id));
1027+
}
10321028

10331029
let shared = SharedBenchmarkConfig {
10341030
toolchain,
@@ -2045,28 +2041,6 @@ fn log_db(db_option: &DbOption) {
20452041
println!("Using database `{}`", db_option.db);
20462042
}
20472043

2048-
async fn purge_old_data(
2049-
conn: &mut dyn Connection,
2050-
artifact_id: &ArtifactId,
2051-
purge_mode: Option<PurgeMode>,
2052-
) {
2053-
match purge_mode {
2054-
Some(PurgeMode::Old) => {
2055-
// Delete everything associated with the artifact
2056-
conn.purge_artifact(artifact_id).await;
2057-
}
2058-
Some(PurgeMode::Failed) => {
2059-
// Delete all benchmarks that have an error for the given artifact
2060-
let artifact_row_id = conn.artifact_id(artifact_id).await;
2061-
let errors = conn.get_error(artifact_row_id).await;
2062-
for krate in errors.keys() {
2063-
conn.collector_remove_step(artifact_row_id, krate).await;
2064-
}
2065-
}
2066-
None => {}
2067-
}
2068-
}
2069-
20702044
/// Record a collection entry into the database, specifying which benchmark steps will be executed.
20712045
async fn init_collection(
20722046
connection: &mut dyn Connection,

0 commit comments

Comments
 (0)