A couple of fixes to progress output

Need to have some integration tests.
This commit is contained in:
Zhaofeng Li 2021-11-21 16:02:45 -08:00
parent b3016ad3a7
commit 572f77dbf5
3 changed files with 8 additions and 5 deletions

View file

@ -284,6 +284,7 @@ impl Deployment {
// FIXME: Remote builder?
let nix_options = self.hive.nix_options().await.unwrap();
let mut builder = host::local(nix_options);
builder.set_job(Some(job.clone()));
let map = derivation.realize(&mut *builder).await?;

View file

@ -93,6 +93,10 @@ impl Host for Local {
async fn active_derivation_known(&mut self) -> NixResult<bool> {
Ok(true)
}
fn set_job(&mut self, job: Option<JobHandle>) {
self.job = job;
}
}
impl Local {

View file

@ -74,6 +74,9 @@ pub trait Host: Send + Sync + std::fmt::Debug {
/// exist on the host.
async fn realize_remote(&mut self, derivation: &StorePath) -> NixResult<Vec<StorePath>>;
/// Provides a JobHandle to use during operations.
fn set_job(&mut self, bar: Option<JobHandle>);
/// Realizes the specified local derivation on the host then retrieves the outputs.
async fn realize(&mut self, derivation: &StorePath) -> NixResult<Vec<StorePath>> {
let options = CopyOptions::default();
@ -122,9 +125,4 @@ pub trait Host: Send + Sync + std::fmt::Debug {
async fn run_command(&mut self, command: &[&str]) -> NixResult<()> {
Err(NixError::Unsupported)
}
/// Provides a JobHandle to use during operations.
#[allow(unused_variables)]
fn set_job(&mut self, bar: Option<JobHandle>) {
}
}