似乎是一个永恒的问题,但却没有答案。
我在 Docker 容器中的 lambda 函数中运行 R。 Lambda 的当前内存限制是 10GB 加上 10GB 临时内存。
在我的码头,我选择我的包裹等:
ENV R_VERSION=4.0.3
RUN tar xvzf pandoc-2.17.1.1-linux-amd64.tar.gz
然后经过更多的混乱,我最终跑了:
rmarkdown::render(
input = report_rmd,
params = param_list,
output_file = output_file,
output_dir = output_dir,
rmd_file = "home.rmd"
intermediates_dir = temporary_directory,
envir = new.env()
)
rmarkdown 完成但是当我为报告提供足够大的数据集时,它将失败并出现此错误:
pandoc document conversion failed with error 127
Duration: 71455 ms Memory Size: 10240 MB Max Memory Used: 6592 MB
持续时间和内存由我的 Lambda 实例报告。看来我有更多的内存可以使用,但一些对此错误的研究表明这是一个内存问题。
我在 rmarkdown YAML 标头中看到了更改 pandoc 堆栈大小的建议,但我无法理解这一点。在我的本地机器上,我可以快速进行实验,所以我做了这个改变 - 预计会失败:
output:
distill::distill_article:
toc: true
toc_depth: 2
theme: theme.css
pandoc_args: [
"+RTS", "-K1m",
"-RTS"
]
我已经将它减少到 1m 以进行相当大的运行并且它似乎工作正常。我 can 看到变化反映在执行的命令中。
"C:/Program Files/RStudio/bin/quarto/bin/pandoc" +RTS -K512m -RTS full.knit.md --to html5 --from markdown+autolink_bare_uris+tex_math_single_backslash --output full.html --lua-filter "C:\Users\thebi\Documents\R\win-library\4.1\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\thebi\Documents\R\win-library\4.1\rmarkdown\rmarkdown\lua\latex-div.lua" --self-contained +RTS -K1m -RTS --standalone --table-of-contents
你需要滚动很远,但它就在那里!
+RTS -K1m -RTS
。奇怪的是,默认值仍然首先包括在内。
然后我将它减少到 128k,嘿,presto,我们有一个有用的(如果不相关的)错误消息:
pandoc.exe: Stack space overflow: current size 33624 bytes.
pandoc.exe: Use `+RTS -Ksize -RTS' to increase it.
Error: pandoc document conversion failed with error 2
问题: