diff options
author | edef <edef@edef.eu> | 2024-10-19T19·23+0000 |
---|---|---|
committer | edef <edef@edef.eu> | 2024-10-20T21·22+0000 |
commit | 84a82f6f41b422f7f76e44e3705ee509b6c6eaf6 (patch) | |
tree | e9db1e7d323cd4be497d13632f8c6ad772736053 /users/edef/weave/src/lib.rs | |
parent | b3f0e25fbc29278381bdb4408285aa8b7d345d50 (diff) |
feat(users/edef/weave): use tracing_indicatif for progress r/8849
Progress bars :3 Change-Id: I770d0f8381521b6efc8b38c0db4d59c771887fee Reviewed-on: https://cl.tvl.fyi/c/depot/+/12673 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'users/edef/weave/src/lib.rs')
-rw-r--r-- | users/edef/weave/src/lib.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/users/edef/weave/src/lib.rs b/users/edef/weave/src/lib.rs index 4ccd566ca52d..ff5bf9232676 100644 --- a/users/edef/weave/src/lib.rs +++ b/users/edef/weave/src/lib.rs @@ -8,6 +8,7 @@ use std::{ slice, sync::Arc, }; +use tracing_indicatif::span_ext::IndicatifSpanExt as _; use polars::{ datatypes::BinaryChunked, @@ -20,7 +21,6 @@ pub type FixedBytes<const N: usize> = ArcRef<'static, polars::export::arrow::buffer::Bytes<u8>, [[u8; N]]>; pub const INDEX_NULL: u32 = !0; -pub const DONE: &str = "\u{2714}"; /// A terrific hash function, turning 20 bytes of cryptographic hash /// into 8 bytes of cryptographic hash. @@ -42,8 +42,13 @@ pub fn leak<O, T: ?Sized>(r: OwningRef<Arc<O>, T>) -> &T { /// Read a dense `store_path_hash` array from `narinfo.parquet`, /// returning it as an owned [FixedBytes]. +#[tracing::instrument(fields(indicatif.pb_show = tracing::field::Empty))] pub fn load_ph_array() -> Result<FixedBytes<20>> { - eprint!("… load store_path_hash\r"); + let span = tracing::Span::current(); + + span.pb_set_message("load store_path_hash"); + span.pb_start(); + // TODO(edef): this could use a further pushdown, since polars is more hindrance than help here // We know this has to fit in memory (we can't mmap it without further encoding constraints), // and we want a single `Vec<[u8; 20]>` of the data. @@ -57,7 +62,6 @@ pub fn load_ph_array() -> Result<FixedBytes<20>> { ); u32::try_from(ph_array.len()).expect("dataset exceeds 2^32"); - eprintln!("{DONE}"); Ok(ph_array) } |