summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-03-17 09:30:03 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-03-17 19:05:05 +0100
commit434cfab4df31aedb9bb104ee0b1facf810be0e59 (patch)
treef2fc1bbec33b135db63bb2e444ae30209fec1f12
parente3f3e3b06b727312dbf5f913f17a012c73234667 (diff)
Make error on closed channel more verbose
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r--src/orchestrator/orchestrator.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/orchestrator/orchestrator.rs b/src/orchestrator/orchestrator.rs
index cc57a49..5df05c1 100644
--- a/src/orchestrator/orchestrator.rs
+++ b/src/orchestrator/orchestrator.rs
@@ -16,6 +16,7 @@ use std::path::PathBuf;
use std::sync::Arc;
use anyhow::Error;
+use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use diesel::PgConnection;
@@ -633,7 +634,15 @@ impl<'a> JobTask<'a> {
received_dependencies.insert(*self.jobdef.job.uuid(), artifacts);
trace!("[{}]: Sending to parent: {:?}", self.jobdef.job.uuid(), received_dependencies);
for s in self.sender.iter() {
- s.send(Ok(received_dependencies.clone())).await?;
+ s.send(Ok(received_dependencies.clone()))
+ .await
+ .context("Cannot send received dependencies to parent")
+ .with_context(|| {
+ format!("Sending-Channel is closed in Task for {}: {} {}",
+ self.jobdef.job.uuid(),
+ self.jobdef.job.package().name(),
+ self.jobdef.job.package().version())
+ })?;
}
self.bar.finish_with_message(&format!("[{} {} {}] Reusing artifact",
self.jobdef.job.uuid(),
@@ -686,7 +695,13 @@ impl<'a> JobTask<'a> {
// We know that we have at least one sender available
let mut errormap = HashMap::with_capacity(1);
errormap.insert(job_uuid, e);
- self.sender[0].send(Err(errormap)).await?;
+
+ // Every JobTask has at least one sender, so we can [] here.
+ self.sender[0]
+ .send(Err(errormap))
+ .await
+ .context("Failed sending scheduler errors to parent")
+ .with_context(|| format!("Failed sending error from job {}", self.jobdef.job.uuid()))?;
return Ok(())
},