forked from DGNum/colmena
Merge pull request #191 from pkel/main
Set exit code > 0 when colmena exec fails
This commit is contained in:
commit
c84ccd0a7a
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?;
|
||||
|
||||
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