diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-11-13 09:08:47 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-11-13 09:49:17 +0100 |
commit | 218369da29e361bcaed7221abc9fcc48bf6f388d (patch) | |
tree | 67320137323c059ec4d225c9bdaa0c5c74fc1b44 | |
parent | 4e7510c5037862b87c111e7d2a54a983cffba1d0 (diff) |
Pass Submit object around when scheduling jobs
This is needed because we need to refer to the submit when creating a
Job entry in the database.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | src/endpoint/scheduler.rs | 6 | ||||
-rw-r--r-- | src/orchestrator/orchestrator.rs | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/endpoint/scheduler.rs b/src/endpoint/scheduler.rs index 5172d54..4d198d4 100644 --- a/src/endpoint/scheduler.rs +++ b/src/endpoint/scheduler.rs @@ -29,11 +29,12 @@ pub struct EndpointScheduler { db: Arc<PgConnection>, progressbars: ProgressBars, multibar: indicatif::MultiProgress, + submit: crate::db::models::Submit, } impl EndpointScheduler { - pub async fn setup(endpoints: Vec<EndpointConfiguration>, staging_store: Arc<RwLock<StagingStore>>, db: Arc<PgConnection>, progressbars: ProgressBars) -> Result<Self> { + pub async fn setup(endpoints: Vec<EndpointConfiguration>, staging_store: Arc<RwLock<StagingStore>>, db: Arc<PgConnection>, progressbars: ProgressBars, submit: crate::db::models::Submit) -> Result<Self> { let endpoints = Self::setup_endpoints(endpoints).await?; Ok(EndpointScheduler { @@ -42,6 +43,7 @@ impl EndpointScheduler { db, progressbars, multibar: indicatif::MultiProgress::new(), + submit, }) } @@ -75,6 +77,7 @@ impl EndpointScheduler { job, staging_store: self.staging_store.clone(), db: self.db.clone(), + submit: self.submit.clone(), }) } @@ -109,6 +112,7 @@ pub struct JobHandle { bar: ProgressBar, db: Arc<PgConnection>, staging_store: Arc<RwLock<StagingStore>>, + submit: crate::db::models::Submit, } impl std::fmt::Debug for JobHandle { diff --git a/src/orchestrator/orchestrator.rs b/src/orchestrator/orchestrator.rs index a6f5c3b..33dcd1f 100644 --- a/src/orchestrator/orchestrator.rs +++ b/src/orchestrator/orchestrator.rs @@ -51,7 +51,7 @@ pub struct OrchestratorSetup { impl OrchestratorSetup { pub async fn setup(self) -> Result<Orchestrator> { let db = Arc::new(self.database); - let scheduler = EndpointScheduler::setup(self.endpoint_config, self.staging_store.clone(), db.clone(), self.progress_generator.clone()).await?; + let scheduler = EndpointScheduler::setup(self.endpoint_config, self.staging_store.clone(), db.clone(), self.progress_generator.clone(), self.submit.clone()).await?; Ok(Orchestrator { progress_generator: self.progress_generator, |