mirror of
https://github.com/zhaofengli/colmena.git
synced 2024-08-16 21:20:26 +03:00
Merge pull request #191 from pkel/main
Set exit code > 0 when colmena exec fails
This commit is contained in:
commit
c84ccd0a7a
@ -110,9 +110,18 @@ pub async fn run(
|
||||
}));
|
||||
}
|
||||
|
||||
join_all(futures).await;
|
||||
let results: Vec<Result<(), ColmenaError>> = join_all(futures).await;
|
||||
|
||||
Ok(())
|
||||
let mut failed: usize = 0;
|
||||
|
||||
for x in results {
|
||||
match x {
|
||||
Err(_) => failed += 1,
|
||||
Ok(_) => (),
|
||||
}
|
||||
}
|
||||
|
||||
Ok(failed)
|
||||
});
|
||||
|
||||
let (meta, monitor, output) = tokio::join!(
|
||||
@ -121,9 +130,13 @@ pub async fn run(
|
||||
output.run_until_completion(),
|
||||
);
|
||||
|
||||
meta?;
|
||||
let failed = meta?;
|
||||
monitor?;
|
||||
output?;
|
||||
|
||||
Ok(())
|
||||
if failed > 0 {
|
||||
Err(ColmenaError::ExecError { n_hosts: failed })
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,9 @@ pub enum ColmenaError {
|
||||
|
||||
#[snafu(display("Unknown error: {}", message))]
|
||||
Unknown { message: String },
|
||||
|
||||
#[snafu(display("Exec failed on {} hosts", n_hosts))]
|
||||
ExecError { n_hosts: usize },
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for ColmenaError {
|
||||
|
Loading…
Reference in New Issue
Block a user