How to not execute code with quarto render
#10984
Replies: 3 comments 16 replies
-
I believe |
Beta Was this translation helpful? Give feedback.
-
@danmackinlay Can you share more on the context ?
Some context on execution
Execution of cells can also be controlled with execution option execute:
eval: false When you have results computed once, and you would like to gain speed for next rendering, and not recomputing, two mechanisms can be leveraged:
Things to know about freeze:
I hope this helps understand the logic, and helps you pinpoint what is not clear so that you can ask more precisely and share example. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Fascinating! OK thanks @cderv that was an excellent explanation.
My case is that I have a site with `.qmd` files, mostly executing R code.
There is a phenomenon which I find hard to reconcile with the cache flow logic you describe, so if you have a moment to exaplin it further I woudl be grateful.
The situation is as follows:
If I run
```bash
$ quarto render —execute
[ 1/1488] contact.qmd
[ 2/1488] post/ismir2019.qmd
[ 3/1488] post/regression_intro_2022.qmd
[ 4/1488] post/age_equity_dating.qmd
[ 5/1488] post/morandini_and_blamey.qmd
[ 6/1488] post/masters_thesis.qmd
[ 7/1488] post/llm_hacks_2024.qmd
^C⏎
```
it builds the site without executing code. However if I run the following command, it rebuilds the code in my executable notebooks, pausing at the first one it reaches with real code in.
```bash
$ quarto render --no-execute
[ 1/1488] contact.qmd
[ 2/1488] post/ismir2019.qmd
[ 3/1488] post/regression_intro_2022.qmd
[ 4/1488] post/age_equity_dating.qmd
ERROR: Error executing '/usr/local/bin/Rscript': Broken pipe (os error 32)
R installation:
...
```
In fact it failes in this case, because the test environment is missing some R packages, but you get the idea: it is still trying to run the R code only when the `--no-execute` flag is present. This seems reversed compared to how I imagine this flag working. Am I missing something?
… On 7 Oct 2024, at 21:05, Christophe Dervieux ***@***.***> wrote:
@danmackinlay Can you share more on the context ?
• Are you working with computation in Jupyter, Julia or Knitr ?
• Which type of project are you working on ?
Some context on execution
• When working with .ipynb file, no execution will happen by default
• --execute and --no-execute flags can help control (passed internally to nbconvert).
• When working with .qmd, files need to execute to have results output in them so computation is executed by default.
Execution of cells can also be controlled with execution option
execute:
eval: false
When you have results computed once, and you would like to gain speed for next rendering, and not recomputing, two mechanisms can be leveraged:
• Cache which is engine dependent. Cells are executed, but caching mechanism applies at the engine execution level. --cache will activate this for engine globally. It can also be controlled more closely to the engine.
• Freeze which is Quarto specific. In that case, computation does not run at all. Quarto skips this step by loading a stored state of markdown content and results to recreate the intermediate .md file to be used in conversion. --use-freezer forces the use of the cache - which can be useful for an incremental render.
Things to know about freeze:
• on a project with freeze: true or freeze: auto set
• quarto render will always use the freezer if it exists.
• quarto render <a file in the project> will not use the freezer, unless --use-freezer is set.
• If freezer is used, then caching does not matters.
I hope this helps understand the logic, and helps you pinpoint what is not clear so that you can ask more precisely and share example. Thank you!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
According to the CLI help, the following will not execute code in the
.qmd
files in my projectHowever, for me, this seems to force execution.
If I wish to not execute the files I need to run
This leads me to suspect that there is something I do not understand about the
--execute
/--no-execute
flags. Does anyone have insight?Beta Was this translation helpful? Give feedback.
All reactions