feat: add obisys crate for standardized CLI progress reporting
This commit introduces the `obisys` crate, which wraps `indicatif` to provide reusable `spinner` and `progress_bar` utilities with consistent styling and tick intervals. It refactors progress reporting across `obikindex`, `obikpartitionner`, and `obikmer` to use these shared functions, eliminating inline UI configuration and ensuring uniform terminal feedback.
This commit is contained in:
@@ -28,3 +28,4 @@ memmap2 = "0.9.10"
|
||||
obicompactvec = { path = "../obicompactvec" }
|
||||
ptr_hash = "1.1"
|
||||
indicatif = "0.17"
|
||||
obisys = { path = "../obisys" }
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
|
||||
use std::time::Instant;
|
||||
use tracing::debug;
|
||||
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
use obisys::progress_bar;
|
||||
|
||||
use cacheline_ef::{CachelineEf, CachelineEfVec};
|
||||
use epserde::ser::Serialize as EpSerialize;
|
||||
@@ -219,14 +219,7 @@ impl KmerPartition {
|
||||
let n_threads = rayon::current_num_threads().max(1) as u64;
|
||||
let available_per_thread = available / n_threads;
|
||||
|
||||
let pb = ProgressBar::new(self.n_partitions as u64);
|
||||
pb.set_style(
|
||||
ProgressStyle::with_template(
|
||||
"dereplicating [{bar:40}] {pos}/{len} ({percent}%) {per_sec} eta {eta} {msg}",
|
||||
)
|
||||
.unwrap()
|
||||
.progress_chars("█▌░"),
|
||||
);
|
||||
let pb = progress_bar("dereplication", self.n_partitions as u64, "partitions");
|
||||
|
||||
let results: Vec<SKResult<()>> = (0..self.n_partitions)
|
||||
.into_par_iter()
|
||||
@@ -274,14 +267,7 @@ impl KmerPartition {
|
||||
let n_threads = rayon::current_num_threads().max(1) as u64;
|
||||
let chunk_kmers = chunk_size_from_ram(available / n_threads);
|
||||
|
||||
let pb = ProgressBar::new(self.n_partitions as u64);
|
||||
pb.set_style(
|
||||
ProgressStyle::with_template(
|
||||
"counting [{bar:40}] {pos}/{len} ({percent}%) {per_sec} eta {eta} {msg}",
|
||||
)
|
||||
.unwrap()
|
||||
.progress_chars("█▌░"),
|
||||
);
|
||||
let pb = progress_bar("counting", self.n_partitions as u64, "partitions");
|
||||
|
||||
let results: Vec<SKResult<()>> = (0..self.n_partitions)
|
||||
.into_par_iter()
|
||||
|
||||
Reference in New Issue
Block a user