Sequential batch runner with per-series status rows and a structured CSV log.
Existing outputs can be skipped via resume = TRUE.
Usage
sa_batch_run(
series,
out_dir = "sa_reports",
ids = NULL,
resume = TRUE,
timeout = Inf,
report_fun = sa_report_html,
log_file = NULL,
...
)Arguments
- series
A
tsobject or a non-empty list of series.- out_dir
Directory where HTML reports and
_sa_run_log.csvare written.- ids
Optional character vector of IDs, same length as
series.- resume
If
TRUE, existing output files are skipped and logged asskipped.- timeout
Per-series timeout in seconds. Use
Infto run in the current R process without a timeout. Finite values require the suggestedcallrpackage and run each case in a clean subprocess.- report_fun
Report function to call per item. Defaults to
sa_report_html().- log_file
Optional CSV log path. Defaults to
_sa_run_log.csvinout_dir.- ...
Additional arguments passed to
report_fun.
Value
A tibble with one row per series: id, ok, status, reason,
message, outfile, and elapsed_seconds.
Examples
fake_report <- function(y, outfile, ...) {
writeLines("<html><body>ok</body></html>", outfile)
list(report = outfile)
}
out <- sa_batch_run(
series = list(series1 = AirPassengers),
out_dir = tempdir(),
report_fun = fake_report
)
out$status
#> [1] "ok"
