
Install a progressr handler for interactive R and for job logs
Source:R/progress_handlers.R
setup_progress_handlers.RdSets progressr::handlers(global = TRUE) and installs a handler chosen by
interactive(). An interactive session gets a repainting progress bar; a
job log gets one plain line per interval.
Details
Interactive sessions (normal R console, RStudio foreground console):
progressr::handler_progress()withclear = TRUE. The bar repaints in place and disappears when the run finishes.Non-interactive sessions (Rscript, Slurm, CI, RStudio background jobs spawned via Source as Background Job /
rstudioapi::jobRunScript()): one plain line on stderr, at most one per interval, plus one line when the progression finishes. The handler writes no carriage return, sogrepandtailstay usable on the log file.
A non-interactive line looks like this:
Set the interval in seconds with options(swereg.progress_interval_s = ...).
The default is 600 seconds.
Also forces options("progressr.enable" = TRUE) so progressr emits signals
in non-interactive sessions. Without this, every progressor() emission is
silently dropped in a background job and no progress ever appears.