mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-07 02:21:23 +00:00
"semi persistent dir" needs cleanup, this is confusing
This commit is contained in:
1 parent
1a3e111dd6
commit
37c016cecb
3 files changed
+12
-22
No files matched your search
+3
-3
@@ -39,7 +39,7 @@ pub async fn download_static_dependencies<'a>(
|
||||
&mut job_progress_reporter,
|
||||
"downloading vocoder (1 of 3)",
|
||||
job.id.0,
|
||||
&job_dependencies.fs.scoped_temp_dir_creator_for_short_lived_downloads,
|
||||
&job_dependencies.fs.scoped_temp_dir_creator_for_long_lived_downloads,
|
||||
).await?;
|
||||
|
||||
waveglow_vocoder_model_fs_path
|
||||
@@ -61,7 +61,7 @@ pub async fn download_static_dependencies<'a>(
|
||||
&mut job_progress_reporter,
|
||||
"downloading vocoder (2 of 3)",
|
||||
job.id.0,
|
||||
&job_dependencies.fs.scoped_temp_dir_creator_for_short_lived_downloads,
|
||||
&job_dependencies.fs.scoped_temp_dir_creator_for_long_lived_downloads,
|
||||
).await?;
|
||||
|
||||
hifigan_vocoder_model_fs_path
|
||||
@@ -83,7 +83,7 @@ pub async fn download_static_dependencies<'a>(
|
||||
&mut job_progress_reporter,
|
||||
"downloading vocoder (3 of 3)",
|
||||
job.id.0,
|
||||
&job_dependencies.fs.scoped_temp_dir_creator_for_short_lived_downloads,
|
||||
&job_dependencies.fs.scoped_temp_dir_creator_for_long_lived_downloads,
|
||||
).await?;
|
||||
|
||||
hifigan_superres_vocoder_model_fs_path
|
||||
|
||||
@@ -119,20 +119,10 @@ async fn main() -> AnyhowResult<()> {
|
||||
)?;
|
||||
|
||||
// Where we download models and resources to (typically a shared NFS volume in prod).
|
||||
let temp_directory_downloads = easyenv::get_env_pathbuf_or_default(
|
||||
"TEMP_DIR_DOWNLOADS",
|
||||
PathBuf::from("/tmp/downloads")
|
||||
);
|
||||
|
||||
// //// Where we store scratch files for workloads (temporary processing).
|
||||
// let temp_directory_work = easyenv::get_env_pathbuf_or_default(
|
||||
// "TEMP_DIR_WORK",
|
||||
// PathBuf::from("/tmp/work")
|
||||
// );
|
||||
|
||||
|
||||
let semi_persistent_cache =
|
||||
SemiPersistentCacheDir::configured_root(&temp_directory_downloads);
|
||||
let semi_persistent_cache = SemiPersistentCacheDir::configured_root(
|
||||
easyenv::get_env_pathbuf_or_default("SEMI_PERSISTENT_DIR_ROOT",
|
||||
PathBuf::from("/tmp/persistent")));
|
||||
|
||||
let db_connection_string =
|
||||
easyenv::get_env_string_or_default(
|
||||
|
||||
@@ -13,7 +13,7 @@ use crate::util::scoped_temp_dir_creator::ScopedTempDirCreator;
|
||||
|
||||
pub async fn maybe_download_file_from_bucket(
|
||||
name_or_description_of_file: &str,
|
||||
file_path: &Path,
|
||||
final_filesystem_file_path: &Path,
|
||||
bucket_object_path: &Path,
|
||||
bucket_client: &BucketClient,
|
||||
job_progress_reporter: &mut Box<dyn JobProgressReporter>,
|
||||
@@ -22,12 +22,12 @@ pub async fn maybe_download_file_from_bucket(
|
||||
scoped_tempdir_creator: &ScopedTempDirCreator,
|
||||
) -> Result<(), ProcessSingleJobError> {
|
||||
|
||||
if file_path.exists() {
|
||||
if final_filesystem_file_path.exists() {
|
||||
// TODO(bt, 2022-07-15): Check signature of file
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
warn!("{} does not exist at path: {:?}", name_or_description_of_file, &file_path);
|
||||
warn!("{} does not exist at path: {:?}", name_or_description_of_file, &final_filesystem_file_path);
|
||||
|
||||
job_progress_reporter.log_status(job_progress_update_description)
|
||||
.map_err(|e| ProcessSingleJobError::Other(e))?;
|
||||
@@ -54,15 +54,15 @@ pub async fn maybe_download_file_from_bucket(
|
||||
info!("Downloaded {} from bucket!", name_or_description_of_file);
|
||||
|
||||
info!("Renaming {} temp file from {:?} to {:?}!",
|
||||
name_or_description_of_file, &temp_path, &file_path);
|
||||
name_or_description_of_file, &temp_path, &final_filesystem_file_path);
|
||||
|
||||
std::fs::rename(&temp_path, &file_path)
|
||||
std::fs::rename(&temp_path, &final_filesystem_file_path)
|
||||
.map_err(|e| {
|
||||
safe_delete_temp_directory(&temp_dir);
|
||||
ProcessSingleJobError::from_io_error(e)
|
||||
})?;
|
||||
|
||||
info!("Finished downloading {} file to {:?}", name_or_description_of_file, &file_path);
|
||||
info!("Finished downloading {} file to {:?}", name_or_description_of_file, &final_filesystem_file_path);
|
||||
|
||||
safe_delete_temp_directory(&temp_dir);
|
||||
|
||||
|
||||
Reference in new issue
Block a user