Skip to content

Commit 2e1b967

Browse files
Fix BiocParallel::bpmapply()
1 parent ed0792b commit 2e1b967

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: progressify
2-
Version: 0.0.0-9024
2+
Version: 0.0.0-9025
33
Title: Progress Updates Everywhere
44
Description: The progressify() function rewrites (transpiles) calls to sequential and parallel map-reduce functions such as base::lapply(), purrr::map(), foreach::foreach(), and plyr::llply() to signal progress updates. By combining this function with R's native pipe operator, you have a straightforward way to report progress on iterative computations with minimal refactoring, e.g. 'lapply(x, fcn) |> progressify()' and 'purrr::map(x, fcn) |> progressify()'. It is compatible with the 'futurize' package for parallelization, e.g. 'lapply(x, fcn) |> progressify() |> futurize()' and 'purrr::map(x, fcn) |> futurize() |> progressify()'.
55
Authors@R: c(

R/builtin-BiocParallel.R

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@
2121
# })
2222
#
2323
progressify_BiocParallel <- local({
24-
## bpmapply():
25-
## Argument 'FUN' wrapper that captures '.progressr_progressor' from the
26-
## enclosing environment (i.e. not via arguments), because argument '...'
27-
## of bpmapply() is used for data, not for passing extra arguments to FUN()
28-
template_FUN_closure <- bquote_compile(function(...) {
29-
on.exit(.progressr_progressor())
30-
.(FUN)(...)
31-
})
32-
3324
function(expr, fcn_name, fcn, ..., envir = parent.frame()) {
3425
names <- names(expr)
3526
if (is.null(names)) names <- rep("", length.out = length(expr))
@@ -60,6 +51,7 @@ progressify_BiocParallel <- local({
6051
parts[[idx_FUN]] <- bquote_apply(template_FUN, FUN = FUN)
6152

6253
progressr_args <- list(
54+
...FUN = FUN,
6355
.progressr_progressor = quote(.progressr_progressor)
6456
)
6557
parts <- c(parts, progressr_args)
@@ -75,12 +67,19 @@ progressify_BiocParallel <- local({
7567
idx_dots_first <- unnamed_idxs[1L]
7668

7769
parts <- as.list(expr)
70+
along_expr <- parts[[idx_dots_first]]
7871

7972
stopifnot(length(idx_FUN) == 1L)
8073
FUN <- expr[[idx_FUN]]
81-
parts[[idx_FUN]] <- bquote_apply(template_FUN_closure, FUN = FUN)
74+
parts[[idx_FUN]] <- bquote_apply(template_FUN, FUN = FUN)
8275

83-
along_expr <- parts[[idx_dots_first]]
76+
progressr_args <- list(
77+
MoreArgs = bquote(list(
78+
...FUN = .(FUN),
79+
.progressr_progressor = .progressr_progressor
80+
))
81+
)
82+
parts <- c(parts, progressr_args)
8483

8584
bquote_apply(template_outer, ALONG = along_expr, EXPR = as.call(parts))
8685
}

0 commit comments

Comments
 (0)