Set error code > 0 when colmena exec fails
This commit is contained in:
parent
665603956a
commit
bf690423ea
2 changed files with 20 additions and 4 deletions
|
@ -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 a new issue