diff options
author | Florian Klink <flokli@flokli.de> | 2024-06-13T07·32+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-06-13T16·18+0000 |
commit | 29eda2d5b2baa61aea80e2cef3c5508278751421 (patch) | |
tree | 20014f01d23b0aa116cc82813c53cd8c332d29c3 /tvix/cli | |
parent | 7f29cab1cc9b0cc751b49d1dac7694f5841725ab (diff) |
feat(tvix/cli): add toplevel progress span r/8261
This gives some better feedback something is going on, gives a (named) root for all the progress children we're drawing, and also counts the time we are in eval. Change-Id: Ibe81dcebf0a2b59bb0680da62e206eb5270f9d3c Reviewed-on: https://cl.tvl.fyi/c/depot/+/11798 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: aspen <root@gws.fyi>
Diffstat (limited to 'tvix/cli')
-rw-r--r-- | tvix/cli/Cargo.toml | 1 | ||||
-rw-r--r-- | tvix/cli/src/main.rs | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/tvix/cli/Cargo.toml b/tvix/cli/Cargo.toml index d91da42864ad..434e4045e90f 100644 --- a/tvix/cli/Cargo.toml +++ b/tvix/cli/Cargo.toml @@ -23,6 +23,7 @@ rnix = "0.11.0" thiserror = "1.0.38" tokio = "1.28.0" tracing = "0.1.40" +tracing-indicatif = "0.3.6" [dependencies.wu-manber] git = "https://github.com/tvlfyi/wu-manber.git" diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs index bb0b9b768b02..5e0b8c41819d 100644 --- a/tvix/cli/src/main.rs +++ b/tvix/cli/src/main.rs @@ -4,7 +4,8 @@ use clap::Parser; use repl::Repl; use std::rc::Rc; use std::{fs, path::PathBuf}; -use tracing::Level; +use tracing::{instrument, Level, Span}; +use tracing_indicatif::span_ext::IndicatifSpanExt; use tvix_build::buildservice; use tvix_eval::builtins::impure_builtins; use tvix_eval::observer::{DisassemblingObserver, TracingObserver}; @@ -152,6 +153,7 @@ struct IncompleteInput; /// Interprets the given code snippet, printing out warnings, errors /// and the result itself. The return value indicates whether /// evaluation succeeded. +#[instrument(skip_all, fields(indicatif.pb_show=1))] fn interpret( tvix_store_io: Rc<TvixStoreIO>, code: &str, @@ -160,6 +162,11 @@ fn interpret( explain: bool, allow_incomplete: AllowIncomplete, ) -> Result<bool, IncompleteInput> { + let span = Span::current(); + span.pb_start(); + span.pb_set_style(&tvix_tracing::PB_SPINNER_STYLE); + span.pb_set_message("Setting up evaluator…"); + let mut eval = tvix_eval::Evaluation::new( Box::new(TvixIO::new(tvix_store_io.clone() as Rc<dyn EvalIO>)) as Box<dyn EvalIO>, true, @@ -187,6 +194,7 @@ fn interpret( eval.runtime_observer = Some(&mut runtime_observer); } + span.pb_set_message("Evaluating…"); eval.evaluate(code, path) }; |