-
Notifications
You must be signed in to change notification settings - Fork 69
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
Making pb_elapsed update independently of new progress (like pb_spin) #624
Comments
It does update for me: library(cli)
fun <- function() {
fmt <- "{cli::pb_spin} {cli::pb_bar} {cli::pb_percent} [ETA: {cli::pb_eta}] [Elapsed: {cli::pb_elapsed}]"
cli_progress_bar(format = fmt, total = 100)
cli_progress_update(inc = 1)
for (i in 1:1000) {
cli_progress_update(inc = 0)
Sys.sleep(0.1)
}
}
fun() |
OK, then maybe it's about how cli is being used by purrr, bc this is how I use it and don't see updates: options(
cli.progress_show_after = 0
, cli.progress_clear = FALSE
, cli.progress_bar_style = 'dot'
, cli.progress_format_iterator = "{cli::pb_spin} {cli::pb_bar} {cli::pb_percent} | ETA: {cli::pb_eta} | Elapsed: {cli::pb_elapsed}"
)
map(
.x = 1:10 %>% as.list()
, .f = ~ Sys.sleep(1)
, .progress = T
) |
Oh, I just realized I'm too used to the progress from parallel compute which has an async orientation not applicable to a single R session as the cli/purrr combo aims at. Sorry for my confusion! |
Yeah, hopefully in the future we'll be able to update the progress bar from another thread, but this is quite tricky in R, and currently we don't do it. |
When I have a bar of format:
The elapsed time is static between updates of the new-progress-dependent elements (bar, percent, eta), which feels odd UI-wise, especially given that the spinner can update more rapidly and independently of the new-progress-dependent elements. Am I missing an obvious way to make the pb_elapsed element update independently of new progress?
Edit: huh, updates to pb_spin is also new-progress-dependent; thought I remembered seeing it moving between progress updates but seems my memory was flawed.
The text was updated successfully, but these errors were encountered: