diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-12-07 13:31:33 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-12-07 13:31:33 +0100 |
commit | 17e907e1863d8fecf25edac01d81d595b45a9b69 (patch) | |
tree | 55deefea0f5905eb942e8e35f9994c450044e538 /src/endpoint/configured.rs | |
parent | 83b3b97fee854e19c63999e4daadf802784a1499 (diff) |
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 <mail@beyermatthias.de>
Diffstat (limited to 'src/endpoint/configured.rs')
-rw-r--r-- | src/endpoint/configured.rs | 7 |
1 files changed, 3 insertions, 4 deletions
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<LogItem>, staging: Arc<RwLock<StagingStore>>) -> RResult<(Vec<PathBuf>, 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<LogItem>, staging: Arc<RwLock<StagingStore>>) -> RResult<(Vec<ArtifactPath>, 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())) |