Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ Rplots.pdf$
#----------------------------
^.ghi
^.issues
^.*\.Rproj$
^\.Rproj\.user$
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
.make/*.md.rsp
docs/
.Rdump
.Rproj.user
BiocParallel.FutureParam.Rproj
7 changes: 5 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ Imports:
methods
Suggests:
markdown,
R.rsp
R.rsp,
future.batchtools
Remotes:
bioc::BiocParallel
VignetteBuilder:
R.rsp
Title: Use Futures with BiocParallel
Expand All @@ -21,5 +24,5 @@ License: LGPL (>= 2.1)
LazyLoad: TRUE
URL: https://BiocParallel.FutureParam.futureverse.org, https://github.com/HenrikBengtsson/BiocParallel.FutureParam
BugReports: https://github.com/HenrikBengtsson/BiocParallel.FutureParam/issues
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
Roxygen: list(markdown = TRUE)
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ if (getRversion() >= "3.6.0") {
importFrom(BiocParallel,.BiocParallelParam_prototype)
}
export(FutureParam)
importFrom(BiocParallel,bpRNGseed)
importFrom(BiocParallel,bpexportglobals)
importFrom(BiocParallel,bplog)
importFrom(BiocParallel,bplogdir)
importFrom(BiocParallel,bploop)
importFrom(BiocParallel,bpok)
importFrom(BiocParallel,bpoptions)
importFrom(BiocParallel,bpparam)
importFrom(BiocParallel,bpstopOnError)
importFrom(BiocParallel,bpthreshold)
Expand Down
31 changes: 22 additions & 9 deletions R/FutureParam-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ setReplaceMethod("bplogdir", c("FutureParam", "character"), function(x, value) {
###

#' @importFrom methods setMethod
#' @importFrom BiocParallel bplog bpok bpparam bpstopOnError bpthreshold bptimeout
#' @importFrom BiocParallel bplog bpok bpparam bpstopOnError bpthreshold bptimeout bpexportglobals
#' @importFrom future future resolve value
setMethod("bplapply", c("ANY", "FutureParam"), function(X, FUN, ..., BPREDO=list(), BPPARAM=bpparam()) {
.composeTry <- importBP(".composeTry")
.workerOptions <- importBP('.workerOptions')
.error_bplist <- importBP(".error_bplist")
.log_load <- importBP(".log_load")
.redo_index <- importBP(".redo_index")
Expand All @@ -140,9 +141,14 @@ setMethod("bplapply", c("ANY", "FutureParam"), function(X, FUN, ..., BPREDO=list

.log_load(bplog(BPPARAM), bpthreshold(BPPARAM))

FUN <- .composeTry(FUN, bplog(BPPARAM), bpstopOnError(BPPARAM),
stop.immediate=bpstopOnError(BPPARAM),
timeout=bptimeout(BPPARAM))
OPTIONS <- .workerOptions(
log = bplog(BPPARAM),
stop.on.error = bpstopOnError(BPPARAM),
timeout = bptimeout(BPPARAM),
exportglobals = bpexportglobals(BPPARAM)
)

FUN <- .composeTry(FUN, OPTIONS, bpRNGseed(BPPARAM))

## Create futures
fs <- list()
Expand Down Expand Up @@ -173,11 +179,12 @@ setMethod("bplapply", c("ANY", "FutureParam"), function(X, FUN, ..., BPREDO=list


#' @importFrom methods setMethod
#' @importFrom BiocParallel bploop bplog bptimeout bpstopOnError
#' @importFrom BiocParallel bploop bplog bptimeout bpstopOnError bpoptions bpRNGseed
#' @importFrom future future resolve value
setMethod("bpiterate", c("ANY", "ANY", "FutureParam"), function(ITER, FUN, ..., REDUCE, init, reduce.in.order=FALSE, BPPARAM=bpparam()) {
setMethod("bpiterate", c("ANY", "ANY", "FutureParam"), function(ITER, FUN, ..., REDUCE, init, reduce.in.order=FALSE, BPREDO = list(),BPPARAM=bpparam(),BPOPTIONS = bpoptions()) {
.composeTry <- importBP(".composeTry")

.workerOptions <- importBP(".workerOptions")

ITER <- match.fun(ITER)
FUN <- match.fun(FUN)
hasREDUCE <- !missing(REDUCE)
Expand All @@ -192,8 +199,14 @@ setMethod("bpiterate", c("ANY", "ANY", "FutureParam"), function(ITER, FUN, ...,
}
}

FUN <- .composeTry(FUN, bplog(BPPARAM), bpstopOnError(BPPARAM),
timeout=bptimeout(BPPARAM))
OPTIONS <- .workerOptions(
log = bplog(BPPARAM),
stop.on.error = bpstopOnError(BPPARAM),
timeout = bptimeout(BPPARAM),
exportglobals = bpexportglobals(BPPARAM)
)

FUN <- .composeTry(FUN, OPTIONS, bpRNGseed(BPPARAM))
ARGFUN <- function(value) c(list(value), list(...))


Expand Down