From 17e907e1863d8fecf25edac01d81d595b45a9b69 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 7 Dec 2020 13:31:33 +0100 Subject: Add ArtifactPath, StoreRoot This is the first step towards strong path typing for distinction between artifact pathes. It adds a type for Store root pathes and a type for artifact pathes. Signed-off-by: Matthias Beyer --- src/endpoint/configured.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/endpoint/configured.rs') diff --git a/src/endpoint/configured.rs b/src/endpoint/configured.rs index 32a18fd..df2aa77 100644 --- a/src/endpoint/configured.rs +++ b/src/endpoint/configured.rs @@ -20,6 +20,7 @@ use typed_builder::TypedBuilder; use crate::endpoint::ContainerError; use crate::endpoint::EndpointConfiguration; +use crate::filestore::path::ArtifactPath; use crate::filestore::StagingStore; use crate::job::JobResource; use crate::job::RunnableJob; @@ -175,9 +176,7 @@ impl Endpoint { .map(|_| ()) } - pub async fn run_job(&self, job: RunnableJob, logsink: UnboundedSender, staging: Arc>) -> RResult<(Vec, ContainerHash, Script), ContainerError> { - - let staging_store_path = staging.read().await.root_path().to_path_buf(); + pub async fn run_job(&self, job: RunnableJob, logsink: UnboundedSender, staging: Arc>) -> RResult<(Vec, ContainerHash, Script), ContainerError> { let (container_id, _warnings) = { let envs = job.environment() .into_iter() @@ -267,7 +266,7 @@ impl Endpoint { .with_context(|| anyhow!("Collecting artifacts for copying to container {}", container_id))?; let destination = PathBuf::from("/inputs/").join(artifact_file_name); trace!("Copying {} to container: {}:{}", art.path().display(), container_id, destination.display()); - let buf = tokio::fs::read(staging_store_path.join(art.path())) + let buf = tokio::fs::read(staging.read().await.root_path().join(art.path())) .await .map(Vec::from) .with_context(|| anyhow!("Reading artifact {}, so it can be copied to container", art.path().display())) -- cgit v1.2.3