Skip to content

Commit 1e8c28d

Browse files
Don't delay relaying in non-interactive mode
1 parent 8187059 commit 1e8c28d

File tree

6 files changed

+12
-5
lines changed

6 files changed

+12
-5
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Suggests:
1616
pbmcapply,
1717
plyr,
1818
progress,
19+
future,
1920
doFuture,
2021
future.apply,
2122
furrr

R/with_progress.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#' @example incl/with_progress.R
2121
#'
2222
#' @export
23-
with_progress <- function(expr, handlers = getOption("progressr.handlers", txtprogressbar_handler()), cleanup = TRUE, delay_stdout = TRUE, delay_conditions = c("condition")) {
23+
with_progress <- function(expr, handlers = getOption("progressr.handlers", txtprogressbar_handler()), cleanup = TRUE, delay_stdout = getOption("progressr.delay_stdout", interactive()), delay_conditions = getOption("progressr.delay_conditions", if (interactive()) c("condition") else character(0L))) {
2424
stop_if_not(is.logical(cleanup), length(cleanup) == 1L, !is.na(cleanup))
2525

2626
## FIXME: With zero handlers, progression conditions will be
@@ -99,7 +99,7 @@ with_progress <- function(expr, handlers = getOption("progressr.handlers", txtpr
9999
}
100100
}, add = TRUE)
101101
}
102-
}
102+
} ## if (delay_stdout || length(delay_conditions) > 0)
103103

104104
## Reset all handlers up start
105105
withCallingHandlers({

man/with_progress.Rd

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/zzz,doFuture.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ options(progressr.interval = 0.0, delay = 0.01)
44
if (requireNamespace("doFuture", quietly = TRUE)) {
55
library("doFuture", character.only = TRUE)
66
registerDoFuture()
7+
future::plan("multiprocess")
78
with_progress({
89
p <- progressor(4)
910
y <- foreach(n = 3:6) %dopar% {

tests/zzz,furrr.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ library(progressr)
22
options(progressr.interval = 0.0, delay = 0.1)
33

44
if (requireNamespace("furrr", quietly = TRUE)) {
5+
future::plan("multiprocess")
56
with_progress({
67
p <- progressor(4)
78
y <- furrr::future_map(3:6, function(n) {

tests/zzz,future.apply.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
library(progressr)
2-
options(progressr.interval = 0.0, delay = 0.01)
2+
options(progressr.interval = 0.0, delay = 0.1)
3+
options(progressr.enable = TRUE)
34

45
if (requireNamespace("future.apply", quietly = TRUE)) {
6+
future::plan("multiprocess")
57
with_progress({
68
p <- progressor(4)
79
y <- future.apply::future_lapply(3:6, function(n) {

0 commit comments

Comments
 (0)