Skip to content

Commit b867f05

Browse files
authored
Enable passing strings and lists to .progress when in_parallel() (#1212)
* Enable passing strings and lists to `.progress` when `in_parallel()` * Update and match behaviour to non-parallel case
1 parent baa859c commit b867f05

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

DESCRIPTION

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Suggests:
2828
httr,
2929
knitr,
3030
lubridate,
31-
mirai (>= 2.4.0),
31+
mirai (>= 2.4.1.9002),
3232
rmarkdown,
3333
testthat (>= 3.0.0),
3434
tibble,
@@ -45,4 +45,6 @@ Config/testthat/parallel: TRUE
4545
Encoding: UTF-8
4646
Roxygen: list(markdown = TRUE)
4747
RoxygenNote: 7.3.2
48-
Remotes: r-lib/carrier
48+
Remotes:
49+
r-lib/carrier,
50+
r-lib/mirai

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
* `in_parallel()` now accepts objects, including helper functions, supplied to `...` for all locally-defined functions (#1208).
44

5+
* `in_parallel()` now works in conjunction with string and list values supplied to the `.progress` argument of map functions (#1203).
6+
57
* All functions that were soft-deprecated in purrr 1.0.0 are now fully deprecated. They will be removed in a future release. This includes: `invoke_*()`, `lift_*()`, `cross*()`, `prepend()`, `splice()`, `rbernoulli()`, `rdunif()`, `when()`, `update_list()`, `*_raw()`, `vec_depth()`.
68

79
* `map_chr()` no longer coereces from logical, integer, or double to strings.

R/map.R

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,18 @@ mmap_ <- function(.x, .f, .progress, .type, error_call, ...) {
229229

230230
m <- mirai::mirai_map(.x, .f)
231231

232-
options <- c(".stop", if (isTRUE(.progress)) ".progress")
232+
options <- if (isFALSE(.progress)) {
233+
".stop"
234+
} else if (is.logical(.progress)) {
235+
c(".stop", ".progress")
236+
} else if (is.character(.progress) || is.list(.progress)) {
237+
list(.stop = TRUE, .progress = .progress)
238+
} else {
239+
cli::cli_abort(
240+
"Unknown cli progress bar configuation, see manual.",
241+
call = error_call
242+
)
243+
}
233244
x <- with_parallel_indexed_errors(
234245
mirai::collect_mirai(m, options = options),
235246
interrupt_expr = mirai::stop_mirai(m),

R/parallelization.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ parallel_pkgs_installed <- function() {
187187
{
188188
check_installed(
189189
c("carrier", "mirai"),
190-
version = c("0.2.0.9000", "2.4.0"),
190+
version = c("0.2.0.9000", "2.4.1.9002"),
191191
reason = "for parallel map."
192192
)
193193
the$parallel_pkgs_installed <- TRUE

0 commit comments

Comments
 (0)