RStudio Server doesn't display progress bar properly

I'm using the progress package to show a progress bar in loops. It worked totally fine in RStudio 1.2 on my personal computer. However, in RStudio Server 1.1.456, the progress bar doesn't display properly. It doesn't show up, until the loop finishes and a bar with 100% shows up. Here's an example from progress's documentation:

pb <- progress_bar$new(
  format = "  downloading [:bar] :percent eta: :eta",
  total = 100, clear = FALSE, width= 60)
for (i in 1:100) {
  Sys.sleep(1 / 100)

It seems that base R's txtProgressBar works fine, but I'm using the progress bar from progress because it can show eta and time elapsed.

The download bar seems to work fine for me if I sleep a little bit longer (e.g. 1 / 10). Would it be worth tweaking the sleep rate a bit here?

OK, never mind, it does work when the sleep time in the toy example is longer. Just somehow, yesterday, when I used the progress bar in a long running loop, like each iteration would take over 10 seconds, the progress bar didn't show up at all in RStudio Server, though it did in RStudio on my personal computer. Perhaps I should just try again. Never mind, it worked; probably last time something got stuck in the first iteration.

1 Like