Skip to content
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

Building quarto book shows non-interactive progress bar #2271

Closed
3 tasks done
hadley opened this issue Jul 20, 2023 · 9 comments
Closed
3 tasks done

Building quarto book shows non-interactive progress bar #2271

hadley opened this issue Jul 20, 2023 · 9 comments
Assignees

Comments

@hadley
Copy link
Contributor

hadley commented Jul 20, 2023

i.e.

processing file: names.Rmd
1/31                   
2/31 [unnamed-chunk-1] 
3/31                   
4/31 [unnamed-chunk-2] 
5/31                   
6/31 [unnamed-chunk-3] 
7/31                   
8/31 [unnamed-chunk-4] 
9/31                   

Previously it was (correctly) using the dynamic progress bar. I'm using knitr 1.43.


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/knitr').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@hadley
Copy link
Contributor Author

hadley commented Jul 24, 2023

Same problem when knitting a single quarto doc when the output appears in the background jobs tab, rather than the build pane.

@cderv
Copy link
Collaborator

cderv commented Jul 31, 2023

Previously it was (correctly) using the dynamic progress bar.

The new behavior cames from discussion in #2221 and commit 47bce01. It was introduced in 1.43

Current detection for simple mode is

knitr/R/utils.R

Lines 1136 to 1149 in ec4c9b6

# test if it is a "terminal" connection (whether \r is supported)
simple = (function() {
# a global option to decide whether to use the simple progress output
if (!is.null(res <- getOption('knitr.progress.simple'))) return(res)
if (identical(con, '')) con = stdout()
if (!inherits(con, 'connection')) return(TRUE)
if (isatty(con)) return(FALSE)
# when RStudio is available, return FALSE
is.null(tryCatch(rstudioapi::versionInfo(), error = function(e) NULL))
})()
# use simple progress output without the bar but only progress and labels
if (simple) return(list(
update = function(i) cat_line(i, '/', total, s[i], '\n')
))

When quarto is running R it will do it executing R in background session started with Deno as Rscript <file>. None of the specific checks return FALSE to no activate simple mode , and knitr will then detect that it is not running in RStudio IDE so activate the simple version (is.null(tryCatch(rstudioapi::versionInfo(), error = function(e) NULL)) returns TRUE

So probably the current detection does not work for the case of knitr run within Quarto. We need to find what works for this case....

I think even cli::is_dynamic_tty() is returning FALSE in the context of the R code executed by Quarto directly.

@yihui
Copy link
Owner

yihui commented Aug 23, 2023

We need to find what works for this case....

I'm using an env var to detect the background jobs pane. This should work now.

@yihui yihui self-assigned this Aug 23, 2023
@cderv
Copy link
Collaborator

cderv commented Aug 24, 2023

This should work now.

This is now working in Background Job pane inside RStudio.

rather than the build pane.

@hadley I understand there could be a scenario where the Build pane is used ?

Also, I don't know if you were referring only to RStudio IDE panes, but just for referement, in terminal, it will still use the non-interactive progress bar. In same terminal session, we'll have

  • Rscript -e 'rmarkdown::render("index.qmd") showing us the full progress bar
    • This means the knitr detection sees that non-simple progress bar can be used
  • quarto render index.qmd showing us the simple progress bar
    • This means the knitr detection decide that simple progress bar should be used. Probably because background R process as I mentioned previously.

Just mentioning this for reference. The simple progress bar seems ok to have in Terminal for Quarto.

@hadley
Copy link
Contributor Author

hadley commented Aug 24, 2023

Yeah, I see quarto book usually in the build pane.

@cderv
Copy link
Collaborator

cderv commented Aug 25, 2023

Thanks I tried Quarto Website and the Build Pane button triggers a render in the Job Pane.

So it seems only the Build button for a Quarto Book triggers rendering in the Build pane directly.

cderv added a commit that referenced this issue Aug 25, 2023
@cderv
Copy link
Collaborator

cderv commented Aug 25, 2023

It should be ok in build pane now too. thanks

@hadley
Copy link
Contributor Author

hadley commented Aug 26, 2023

Thanks @cderv!

Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants