summaryrefslogtreecommitdiffstats
path: root/src/orchestrator
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-12-08 12:43:11 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-12-08 12:43:11 +0100
commit92177554546f3ed428c6d22d9cc34026c3fd4f0c (patch)
treee6783d95435ccc335b9961eb264b4c599613b013 /src/orchestrator
parentad1f9e4e4daeb5e04871349e7a9eafd8cf64e748 (diff)
Outsource running of RunnableJob on scheduler
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/orchestrator')
-rw-r--r--src/orchestrator/orchestrator.rs26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/orchestrator/orchestrator.rs b/src/orchestrator/orchestrator.rs
index ea451a0..8384103 100644
--- a/src/orchestrator/orchestrator.rs
+++ b/src/orchestrator/orchestrator.rs
@@ -22,6 +22,7 @@ use crate::filestore::MergedStores;
use crate::filestore::ReleaseStore;
use crate::filestore::StagingStore;
use crate::job::JobSet;
+use crate::job::RunnableJob;
use crate::source::SourceCache;
use crate::util::progress::ProgressBars;
@@ -83,16 +84,9 @@ impl<'a> Orchestrator<'a> {
.into_iter()
.map(|runnable| {
let multibar = multibar.clone();
- async {
- let job_id = runnable.uuid().clone();
- trace!("Runnable {} for package {}", job_id, runnable.package().name());
-
- let jobhandle = scheduler.schedule_job(runnable, multibar).await?;
- trace!("Jobhandle -> {:?}", jobhandle);
- let r = jobhandle.run().await;
- trace!("Found result in job {}: {:?}", job_id, r);
- r
+ async {
+ Self::run_runnable(multibar, runnable, &scheduler).await
}
})
.collect::<futures::stream::FuturesUnordered<_>>()
@@ -143,5 +137,19 @@ impl<'a> Orchestrator<'a> {
Ok(report_result)
}
+ async fn run_runnable(multibar: Arc<indicatif::MultiProgress>, runnable: RunnableJob, scheduler: &EndpointScheduler)
+ -> RResult<Vec<Artifact>, ContainerError>
+ {
+ let job_id = runnable.uuid().clone();
+ trace!("Runnable {} for package {}", job_id, runnable.package().name());
+
+ let jobhandle = scheduler.schedule_job(runnable, multibar).await?;
+ trace!("Jobhandle -> {:?}", jobhandle);
+
+ let r = jobhandle.run().await;
+ trace!("Found result in job {}: {:?}", job_id, r);
+ r
+ }
+
}