Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli] ingest all queue fix #20

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
patch order of queue check
Lucietta MacUrchin committed Jan 30, 2025
commit 59c31aeac9f183da4792cb2b0f37250a8cc4b0fd
20 changes: 10 additions & 10 deletions src/load.rs
Original file line number Diff line number Diff line change
@@ -44,29 +44,29 @@ pub async fn ingest_all(

// This manifest may be for a .gz file, we should handle here as well
for (_p, m) in archive_map.0.iter() {
info!("checking if we need to decompress");
let (new_unzip_path, temp) = unzip_temp::maybe_handle_gz(&m.archive_dir)?;
let mut better_man = ManifestInfo::new(&new_unzip_path);
better_man.set_info()?;

println!(
"\nProcessing: {:?} with archive: {}",
better_man.contents,
better_man.archive_dir.display()
m.contents,
m.archive_dir.display()
);

let complete = queue::are_all_completed(pool, &better_man.archive_id).await?;
let complete = queue::are_all_completed(pool, &m.archive_id).await?;

if !complete {
info!("checking if we need to decompress");
let (new_unzip_path, temp) = unzip_temp::maybe_handle_gz(&m.archive_dir)?;
let mut better_man = ManifestInfo::new(&new_unzip_path);
better_man.set_info()?;

let batch_tx_return = try_load_one_archive(&better_man, pool, batch_size).await?;
println!("SUCCESS: {}", batch_tx_return);
drop(temp);
} else {
info!(
"archive complete (or not in queue): {}",
better_man.archive_dir.display()
m.archive_dir.display()
);
}
drop(temp);
}

Ok(())
3 changes: 1 addition & 2 deletions src/unzip_temp.rs
Original file line number Diff line number Diff line change
@@ -125,9 +125,8 @@ pub fn maybe_handle_gz(archive_path: &Path) -> Result<(PathBuf, Option<TempPath>
// maybe stuff isn't unzipped yet
let pattern = format!("{}/*.*.gz", archive_path.display());
if glob(&pattern)?.count() > 0 {
let mut temp_dir = TempPath::new();
let temp_dir = TempPath::new();
temp_dir.create_as_dir()?;
temp_dir.persist();

// need to preserve the parent dir name in temp, since the manifest files reference it.
let dir_name = archive_path.file_name().unwrap().to_str().unwrap();