summaryrefslogtreecommitdiffstats
path: root/src/orchestrator
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-12-03 09:16:30 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-12-04 08:45:22 +0100
commit0b67aeebc1c50f3a0ba61c6b1fcc0272071d87f8 (patch)
treed6bacb15cb3703054e58a0f29eaf547785b1cf23 /src/orchestrator
parent5b4617aec92fc0f7666162e3a2b8080f87f0258c (diff)
Add strict script interpolation
This patch adds strict script interpolation, which means that the script interpolation will result in an error if a variable is referenced that does not exist. Before this patch, referencing an absent variable did result in an empty string, possibly resulting in an error at runtime. This feature is on by default. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/orchestrator')
-rw-r--r--src/orchestrator/orchestrator.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/orchestrator/orchestrator.rs b/src/orchestrator/orchestrator.rs
index e53cf91..3d98ee5 100644
--- a/src/orchestrator/orchestrator.rs
+++ b/src/orchestrator/orchestrator.rs
@@ -11,8 +11,9 @@ use diesel::PgConnection;
use tokio::sync::RwLock;
use typed_builder::TypedBuilder;
-use crate::db::models::Submit;
+use crate::config::Configuration;
use crate::db::models::Artifact;
+use crate::db::models::Submit;
use crate::endpoint::ContainerError;
use crate::endpoint::EndpointConfiguration;
use crate::endpoint::EndpointScheduler;
@@ -23,16 +24,17 @@ use crate::job::JobSet;
use crate::source::SourceCache;
use crate::util::progress::ProgressBars;
-pub struct Orchestrator {
+pub struct Orchestrator<'a> {
scheduler: EndpointScheduler,
staging_store: Arc<RwLock<StagingStore>>,
release_store: Arc<RwLock<ReleaseStore>>,
source_cache: SourceCache,
jobsets: Vec<JobSet>,
+ config: &'a Configuration,
}
#[derive(TypedBuilder)]
-pub struct OrchestratorSetup {
+pub struct OrchestratorSetup<'a> {
progress_generator: ProgressBars,
endpoint_config: Vec<EndpointConfiguration>,
staging_store: Arc<RwLock<StagingStore>>,
@@ -43,10 +45,11 @@ pub struct OrchestratorSetup {
database: PgConnection,
submit: Submit,
log_dir: Option<PathBuf>,
+ config: &'a Configuration,
}
-impl OrchestratorSetup {
- pub async fn setup(self) -> Result<Orchestrator> {
+impl<'a> OrchestratorSetup<'a> {
+ pub async fn setup(self) -> Result<Orchestrator<'a>> {
let db = Arc::new(self.database);
let scheduler = EndpointScheduler::setup(self.endpoint_config, self.staging_store.clone(), db, self.progress_generator, self.submit.clone(), self.log_dir, self.additional_env).await?;
@@ -56,11 +59,12 @@ impl OrchestratorSetup {
release_store: self.release_store,
source_cache: self.source_cache,
jobsets: self.jobsets,
+ config: self.config,
})
}
}
-impl Orchestrator {
+impl<'a> Orchestrator<'a> {
pub async fn run(self) -> Result<Vec<Artifact>> {
use tokio::stream::StreamExt;
@@ -74,7 +78,7 @@ impl Orchestrator {
let results = { // run the jobs in the set
let unordered_results = futures::stream::FuturesUnordered::new();
- for runnable in jobset.into_runables(&merged_store, &self.source_cache).await?.into_iter() {
+ for runnable in jobset.into_runables(&merged_store, &self.source_cache, &self.config).await?.into_iter() {
let job_id = runnable.uuid().clone();
trace!("Runnable {} for package {}", job_id, runnable.package().name());