forked from DGNum/colmena
deployment: Move GC root creation after build
Previously GC roots were only created after successful activation.
This commit is contained in:
parent
2b0bafa155
commit
9db25bd914
1 changed files with 22 additions and 27 deletions
|
@ -438,7 +438,7 @@ impl Deployment {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds and pushes a system profile on a node.
|
/// Builds and pushes a system profile on a node.
|
||||||
async fn build_and_push_node(self: &DeploymentHandle, parent: JobHandle, mut target: TargetNode, profile_drv: ProfileDerivation)
|
async fn build_and_push_node(self: &DeploymentHandle, parent: JobHandle, target: TargetNode, profile_drv: ProfileDerivation)
|
||||||
-> ColmenaResult<(TargetNode, Profile)>
|
-> ColmenaResult<(TargetNode, Profile)>
|
||||||
{
|
{
|
||||||
let nodes = vec![target.name.clone()];
|
let nodes = vec![target.name.clone()];
|
||||||
|
@ -459,6 +459,26 @@ impl Deployment {
|
||||||
Ok(profile)
|
Ok(profile)
|
||||||
}).await?;
|
}).await?;
|
||||||
|
|
||||||
|
// Create GC root
|
||||||
|
let profile_r = profile.clone();
|
||||||
|
let mut target = if self.options.create_gc_roots {
|
||||||
|
let job = parent.create_job(JobType::CreateGcRoots, nodes.clone())?;
|
||||||
|
let arc_self = self.clone();
|
||||||
|
job.run_waiting(|job| async move {
|
||||||
|
if let Some(dir) = arc_self.hive.context_dir() {
|
||||||
|
job.state(JobState::Running)?;
|
||||||
|
let path = dir.join(".gcroots").join(format!("node-{}", &*target.name));
|
||||||
|
|
||||||
|
profile_r.create_gc_root(&path).await?;
|
||||||
|
} else {
|
||||||
|
job.noop("No context directory to create GC roots in".to_string())?;
|
||||||
|
}
|
||||||
|
Ok(target)
|
||||||
|
}).await?
|
||||||
|
} else {
|
||||||
|
target
|
||||||
|
};
|
||||||
|
|
||||||
if self.goal == Goal::Build {
|
if self.goal == Goal::Build {
|
||||||
return Ok((target, profile));
|
return Ok((target, profile));
|
||||||
}
|
}
|
||||||
|
@ -494,7 +514,6 @@ impl Deployment {
|
||||||
-> ColmenaResult<()>
|
-> ColmenaResult<()>
|
||||||
{
|
{
|
||||||
let nodes = vec![target.name.clone()];
|
let nodes = vec![target.name.clone()];
|
||||||
let target_name = target.name.clone();
|
|
||||||
|
|
||||||
let permit = self.parallelism_limit.apply.acquire().await.unwrap();
|
let permit = self.parallelism_limit.apply.acquire().await.unwrap();
|
||||||
|
|
||||||
|
@ -558,7 +577,7 @@ impl Deployment {
|
||||||
}).await?;
|
}).await?;
|
||||||
|
|
||||||
// Upload post-activation keys
|
// Upload post-activation keys
|
||||||
let target = if self.options.upload_keys {
|
let mut target = if self.options.upload_keys {
|
||||||
let job = parent.create_job(JobType::UploadKeys, nodes.clone())?;
|
let job = parent.create_job(JobType::UploadKeys, nodes.clone())?;
|
||||||
job.run_waiting(|job| async move {
|
job.run_waiting(|job| async move {
|
||||||
let keys = target.config.keys.iter()
|
let keys = target.config.keys.iter()
|
||||||
|
@ -585,30 +604,6 @@ impl Deployment {
|
||||||
target
|
target
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create GC root
|
|
||||||
let profile_r = profile.clone();
|
|
||||||
let mut target = if self.options.create_gc_roots {
|
|
||||||
let job = parent.create_job(JobType::CreateGcRoots, nodes.clone())?;
|
|
||||||
let arc_self = self.clone();
|
|
||||||
job.run_waiting(|job| async move {
|
|
||||||
if target.config.build_on_target() {
|
|
||||||
job.noop("The system profile was built on target node itself".to_string())?;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(dir) = arc_self.hive.context_dir() {
|
|
||||||
job.state(JobState::Running)?;
|
|
||||||
let path = dir.join(".gcroots").join(format!("node-{}", &*target_name));
|
|
||||||
|
|
||||||
profile_r.create_gc_root(&path).await?;
|
|
||||||
} else {
|
|
||||||
job.noop("No context directory to create GC roots in".to_string())?;
|
|
||||||
}
|
|
||||||
Ok(target)
|
|
||||||
}).await?
|
|
||||||
} else {
|
|
||||||
target
|
|
||||||
};
|
|
||||||
|
|
||||||
// Reboot
|
// Reboot
|
||||||
if self.options.reboot {
|
if self.options.reboot {
|
||||||
let job = parent.create_job(JobType::Reboot, nodes.clone())?;
|
let job = parent.create_job(JobType::Reboot, nodes.clone())?;
|
||||||
|
|
Loading…
Reference in a new issue