feat: provide guidance if tmp csv file is not found in Quarto rendering#1176
feat: provide guidance if tmp csv file is not found in Quarto rendering#1176
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1176 +/- ##
==========================================
- Coverage 91.23% 91.19% -0.05%
==========================================
Files 15 15
Lines 6070 6050 -20
==========================================
- Hits 5538 5517 -21
- Misses 532 533 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I modified the condition, added explanation to options.R, and added a test for the knitr behavior |
| csv_file_exists <- check_file_exists(files, access = "r", extension = "csv") | ||
| if (!isTRUE(csv_file_exists)) { | ||
| if (isTRUE(getOption("knitr.in.progress")) && | ||
| is.null(getOption("cmdstanr_output_dir")) && |
There was a problem hiding this comment.
It occurs to me that this is checking the option value at read time but what matters is what the option value was at run time.
If between the first render of the document and the later rerender if the user has since set cmdstanr_output_dir then this message will be suppressed.
I have an idea for how we can handle this. I will make some commits when I have time.
There was a problem hiding this comment.
I just opened PR #1178, which takes a different approach to this that avoids this particular problem. Let me know what you think. One issue is that my version solves this problem but is more complicated. If we can figure out how to make your version work then I would prefer that to my version.
Quarto caches the fit object which has paths to the output csv files. By default the output csv files are in tmp directory which gets removed when rendering stops. Cache works if the cmdstanr_output_dir is not a temporary directory. Set cmdstanr_output_dir before creating the fit object
This PR adds an informative message if the csv file is not found, running knitr, and file path has "/tmp"
This PR is pure organic without any AI assistance
Copyright and Licensing
Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Aki Vehtari
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses: