From d21a9aeab8c68f0b84c479ff143c02658f9eda7f Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 15 Feb 2021 09:47:43 +0100 Subject: Fix: Return script errors properly This patch fixes error returning from the JobHandle::run() implementation. Somehow, in the many rewrites, the error returning resulted in code that did not differentiate between script run errors and scheduling errors. This patch fixes this by making the JobHandle::run() method return Result>> whereas the outer error is the scheduling result and the inner error is the script result. The calling code was adapted accordingly. Signed-off-by: Matthias Beyer --- src/orchestrator/orchestrator.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/orchestrator/orchestrator.rs') diff --git a/src/orchestrator/orchestrator.rs b/src/orchestrator/orchestrator.rs index 2860748..a9b1e19 100644 --- a/src/orchestrator/orchestrator.rs +++ b/src/orchestrator/orchestrator.rs @@ -595,9 +595,7 @@ impl<'a> JobTask<'a> { let job_uuid = *self.jobdef.job.uuid(); // Schedule the job on the scheduler - match self.scheduler.schedule_job(runnable, self.bar.clone()).await?.run().await { - // if the scheduler run reports an error, - // that is an error from the actual execution of the job ... + match self.scheduler.schedule_job(runnable, self.bar.clone()).await?.run().await? { Err(e) => { trace!("[{}]: Scheduler returned error = {:?}", self.jobdef.job.uuid(), e); // ... and we send that to our parent @@ -607,6 +605,7 @@ impl<'a> JobTask<'a> { let mut errormap = HashMap::with_capacity(1); errormap.insert(job_uuid, e); self.sender[0].send(Err(errormap)).await?; + return Ok(()) }, // if the scheduler run reports success, -- cgit v1.2.3