From 85c346b16abfc52efc707927f34d25add47907e1 Mon Sep 17 00:00:00 2001 From: discord9 Date: Mon, 10 Mar 2025 11:53:33 +0800 Subject: [PATCH] chore: progress bar --- Cargo.lock | 39 +++++++++++++++++++++++++++----- src/sst-convert/Cargo.toml | 1 + src/sst-convert/src/converter.rs | 3 +++ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d0cff54546..8fe5bb4078 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1594,7 +1594,7 @@ dependencies = [ "bitflags 1.3.2", "strsim 0.8.0", "textwrap 0.11.0", - "unicode-width", + "unicode-width 0.1.14", "vec_map", ] @@ -1876,7 +1876,7 @@ checksum = "b34115915337defe99b2aff5c2ce6771e5fbc4079f4b506301f5cf394c8452f7" dependencies = [ "strum 0.26.3", "strum_macros 0.26.4", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -2469,6 +2469,7 @@ dependencies = [ "encode_unicode", "lazy_static", "libc", + "unicode-width 0.1.14", "windows-sys 0.52.0", ] @@ -4645,7 +4646,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -5599,6 +5600,19 @@ dependencies = [ "serde", ] +[[package]] +name = "indicatif" +version = "0.17.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width 0.2.0", + "web-time 1.1.0", +] + [[package]] name = "inferno" version = "0.11.21" @@ -7536,6 +7550,12 @@ dependencies = [ "libc", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "objc" version = "0.2.7" @@ -7992,7 +8012,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2ad9b889f1b12e0b9ee24db044b5129150d5eada288edc800f789928dc8c0e3" dependencies = [ - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -10088,7 +10108,7 @@ dependencies = [ "radix_trie", "scopeguard", "unicode-segmentation", - "unicode-width", + "unicode-width 0.1.14", "utf8parse", "winapi", ] @@ -11252,6 +11272,7 @@ dependencies = [ "datatypes", "futures", "futures-util", + "indicatif", "meta-client", "metric-engine", "mito2", @@ -11997,7 +12018,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -13100,6 +13121,12 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "unicode-xid" version = "0.2.6" diff --git a/src/sst-convert/Cargo.toml b/src/sst-convert/Cargo.toml index 287b7204f8..140e4c5c6a 100644 --- a/src/sst-convert/Cargo.toml +++ b/src/sst-convert/Cargo.toml @@ -18,6 +18,7 @@ datanode.workspace = true datatypes.workspace = true futures.workspace = true futures-util.workspace = true +indicatif = "0.17.0" meta-client.workspace = true metric-engine.workspace = true mito2.workspace = true diff --git a/src/sst-convert/src/converter.rs b/src/sst-convert/src/converter.rs index 81620ea6d9..faa68aec91 100644 --- a/src/sst-convert/src/converter.rs +++ b/src/sst-convert/src/converter.rs @@ -84,10 +84,13 @@ impl SstConverter { common_telemetry::info!("Converting input {} files", input.len()); let mut outputs = Vec::with_capacity(input.len()); + let bar = indicatif::ProgressBar::new(input.len() as u64); for file in input { let output = self.convert_one(file).await?; outputs.push(output); + bar.inc(1); } + bar.finish(); common_telemetry::info!("Converted {} files", outputs.len());