Skip to content

Log preparation errors #1553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2023
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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion collector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ intern = { path = "../intern" }
futures = "0.3.5"
num_cpus = "1.13"
jobserver = "0.1.21"
crossbeam-utils = "0.8"
snap = "1"
filetime = "0.2.14"
walkdir = "2"
Expand Down
19 changes: 15 additions & 4 deletions collector/src/benchmark/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,31 @@ impl Benchmark {
// to do this in Cargo today. We would also ideally build in the same
// target directory, but that's also not possible, as Cargo takes a
// target-directory global lock during compilation.
crossbeam_utils::thread::scope::<_, anyhow::Result<()>>(|s| {
std::thread::scope::<_, anyhow::Result<()>>(|s| {
let server = jobserver::Client::new(num_cpus::get()).context("jobserver::new")?;
let mut threads = Vec::with_capacity(profile_dirs.len());
for (profile, prep_dir) in &profile_dirs {
let server = server.clone();
s.spawn::<_, anyhow::Result<()>>(move |_| {
let thread = s.spawn::<_, anyhow::Result<()>>(move || {
self.mk_cargo_process(compiler, prep_dir.path(), *profile)
.jobserver(server)
.run_rustc(false)?;
Ok(())
});
threads.push(thread);
}

// Propagate all potential errors and panics eagerly as an error to avoid panicking
// the scope.
for thread in threads {
let result = thread
.join()
.map_err(|error| anyhow::anyhow!("Preparation panicked: {error:?}"))?;
result?;
}

Ok(())
})
.unwrap()?;
})?;

for (profile, prep_dir) in profile_dirs {
eprintln!("Running {}: {:?} + {:?}", self.name, profile, scenarios);
Expand Down