Make parent
in download_auto_job_metrics
optional
This commit is contained in:
parent
94015d3cd4
commit
d14df2652d
2 changed files with 13 additions and 12 deletions
|
@ -180,7 +180,7 @@ fn postprocess_metrics(
|
|||
}
|
||||
|
||||
fn post_merge_report(db: JobDatabase, current: String, parent: String) -> anyhow::Result<()> {
|
||||
let metrics = download_auto_job_metrics(&db, &parent, ¤t)?;
|
||||
let metrics = download_auto_job_metrics(&db, Some(&parent), ¤t)?;
|
||||
|
||||
println!("\nComparing {parent} (parent) -> {current} (this PR)\n");
|
||||
|
||||
|
|
|
@ -46,24 +46,25 @@ pub struct JobMetrics {
|
|||
/// `parent` and `current` should be commit SHAs.
|
||||
pub fn download_auto_job_metrics(
|
||||
job_db: &JobDatabase,
|
||||
parent: &str,
|
||||
parent: Option<&str>,
|
||||
current: &str,
|
||||
) -> anyhow::Result<HashMap<JobName, JobMetrics>> {
|
||||
let mut jobs = HashMap::default();
|
||||
|
||||
for job in &job_db.auto_jobs {
|
||||
eprintln!("Downloading metrics of job {}", job.name);
|
||||
let metrics_parent = match download_job_metrics(&job.name, parent) {
|
||||
Ok(metrics) => Some(metrics),
|
||||
Err(error) => {
|
||||
eprintln!(
|
||||
r#"Did not find metrics for job `{}` at `{parent}`: {error:?}.
|
||||
let metrics_parent =
|
||||
parent.and_then(|parent| match download_job_metrics(&job.name, parent) {
|
||||
Ok(metrics) => Some(metrics),
|
||||
Err(error) => {
|
||||
eprintln!(
|
||||
r#"Did not find metrics for job `{}` at `{parent}`: {error:?}.
|
||||
Maybe it was newly added?"#,
|
||||
job.name
|
||||
);
|
||||
None
|
||||
}
|
||||
};
|
||||
job.name
|
||||
);
|
||||
None
|
||||
}
|
||||
});
|
||||
let metrics_current = download_job_metrics(&job.name, current)?;
|
||||
jobs.insert(
|
||||
job.name.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue