Skip to content

Commit

Permalink
Removed moot argument 'future.lazy' from all functions (fixes #94 and #1
Browse files Browse the repository at this point in the history
)
  • Loading branch information
HenrikBengtsson committed Sep 28, 2021
1 parent b8b57bd commit 4c518ab
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 30 deletions.
8 changes: 6 additions & 2 deletions NEWS
@@ -1,9 +1,13 @@
Package: future.apply
=====================

Version: 1.8.1-9001 [2021-09-23]
Version: 1.8.1-9001 [2021-09-28]

* ...
DEPRECATED AND DEFUNCT:

* Removed moot argument 'future.lazy' from all functions. Regardless of
setting it to TRUE or FALSE, futures would be resolved momentarily and
always before the apply returned.


Version: 1.8.1 [2021-08-09]
Expand Down
3 changes: 1 addition & 2 deletions R/future_apply.R
Expand Up @@ -36,7 +36,7 @@
#'
#' @importFrom future nbrOfWorkers
#' @export
future_apply <- function(X, MARGIN, FUN, ..., simplify = TRUE, future.envir = parent.frame(), future.stdout = TRUE, future.conditions = "condition", future.globals = TRUE, future.packages = NULL, future.lazy = FALSE, future.seed = FALSE, future.scheduling = 1.0, future.chunk.size = NULL, future.label = "future_apply-%d") {
future_apply <- function(X, MARGIN, FUN, ..., simplify = TRUE, future.envir = parent.frame(), future.stdout = TRUE, future.conditions = "condition", future.globals = TRUE, future.packages = NULL, future.seed = FALSE, future.scheduling = 1.0, future.chunk.size = NULL, future.label = "future_apply-%d") {
debug <- getOption("future.apply.debug", getOption("future.debug", FALSE))

FUN <- match.fun(FUN)
Expand Down Expand Up @@ -140,7 +140,6 @@ future_apply <- function(X, MARGIN, FUN, ..., simplify = TRUE, future.envir = pa
future.envir = future.envir,
future.stdout = future.stdout,
future.conditions = future.conditions,
future.lazy = future.lazy,
future.seed = future.seed,
future.scheduling = future.scheduling,
future.chunk.size = future.chunk.size,
Expand Down
6 changes: 1 addition & 5 deletions R/future_lapply.R
Expand Up @@ -33,9 +33,6 @@
#' @param future.packages (optional) a character vector specifying packages
#' to be attached in the R environment evaluating the future.
#'
#' @param future.lazy Specifies whether the futures should be resolved
#' lazily or eagerly (default).
#'
#' @param future.seed A logical or an integer (of length one or seven),
#' or a list of `length(X)` with pre-generated random seeds.
#' For details, see below section.
Expand Down Expand Up @@ -156,7 +153,7 @@ future_lapply <- local({
})
})

function(X, FUN, ..., future.envir = parent.frame(), future.stdout = TRUE, future.conditions = "condition", future.globals = TRUE, future.packages = NULL, future.lazy = FALSE, future.seed = FALSE, future.scheduling = 1.0, future.chunk.size = NULL, future.label = "future_lapply-%d") {
function(X, FUN, ..., future.envir = parent.frame(), future.stdout = TRUE, future.conditions = "condition", future.globals = TRUE, future.packages = NULL, future.seed = FALSE, future.scheduling = 1.0, future.chunk.size = NULL, future.label = "future_lapply-%d") {
fcn_name <- "future_lapply"
args_name <- "X"

Expand Down Expand Up @@ -220,7 +217,6 @@ future_lapply <- local({
future.stdout = future.stdout,
future.conditions = future.conditions,
future.seed = future.seed,
future.lazy = future.lazy,
future.label = future.label,
fcn_name = fcn_name,
args_name = args_name,
Expand Down
3 changes: 1 addition & 2 deletions R/future_mapply.R
Expand Up @@ -42,7 +42,7 @@
#' @keywords manip programming iteration
#'
#' @export
future_mapply <- function(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE, future.envir = parent.frame(), future.stdout = TRUE, future.conditions = "condition", future.globals = TRUE, future.packages = NULL, future.lazy = FALSE, future.seed = FALSE, future.scheduling = 1.0, future.chunk.size = NULL, future.label = "future_mapply-%d") {
future_mapply <- function(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE, future.envir = parent.frame(), future.stdout = TRUE, future.conditions = "condition", future.globals = TRUE, future.packages = NULL, future.seed = FALSE, future.scheduling = 1.0, future.chunk.size = NULL, future.label = "future_mapply-%d") {
fcn_name <- "future_mapply"
args_name <- "..."

Expand Down Expand Up @@ -133,7 +133,6 @@ future_mapply <- function(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES
future.stdout = future.stdout,
future.conditions = future.conditions,
future.seed = future.seed,
future.lazy = future.lazy,
future.label = future.label,
fcn_name = fcn_name,
args_name = args_name,
Expand Down
5 changes: 1 addition & 4 deletions R/future_xapply.R
Expand Up @@ -9,13 +9,11 @@ future_xapply <- local({
.(expr)
})

function(FUN, nX, chunk_args, args = NULL, MoreArgs = NULL, expr, envir = parent.frame(), future.envir, future.globals, future.packages, future.scheduling, future.chunk.size, future.stdout, future.conditions, future.seed, future.lazy, future.label, get_chunk, fcn_name, args_name, ..., debug) {
function(FUN, nX, chunk_args, args = NULL, MoreArgs = NULL, expr, envir = parent.frame(), future.envir, future.globals, future.packages, future.scheduling, future.chunk.size, future.stdout, future.conditions, future.seed, future.label, get_chunk, fcn_name, args_name, ..., debug) {
stop_if_not(is.function(FUN))

stop_if_not(is.logical(future.stdout), length(future.stdout) == 1L)

stop_if_not(is.logical(future.lazy), length(future.lazy) == 1L)

stop_if_not(length(future.scheduling) == 1L, !is.na(future.scheduling),
is.numeric(future.scheduling) || is.logical(future.scheduling))

Expand Down Expand Up @@ -194,7 +192,6 @@ future_xapply <- local({
conditions = future.conditions,
globals = globals_ii, packages = packages_ii,
seed = future.seed,
lazy = future.lazy,
label = labels[ii]
)

Expand Down
4 changes: 0 additions & 4 deletions man/future_apply.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions man/future_lapply.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions man/future_mapply.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tests/future_apply.R
Expand Up @@ -77,7 +77,6 @@ for (strategy in supportedStrategies()) {
future.conditions = NULL,
future.globals = TRUE,
future.packages = NULL,
future.lazy = FALSE,
future.scheduling = 1.0,
future.chunk.size = NULL,
future.label = "future_apply-%d"
Expand Down
3 changes: 1 addition & 2 deletions tests/incl/start,load-only.R
Expand Up @@ -61,8 +61,7 @@ supportedStrategies <- function(cores = 1L, excl = c("multiprocess", "cluster"),
strategies <- future:::supportedStrategies(...)
strategies <- setdiff(strategies, excl)
if (cores > 1) {
strategies <- setdiff(strategies,
c("sequential", "uniprocess", "eager", "lazy"))
strategies <- setdiff(strategies, c("sequential", "uniprocess"))
}
strategies
}
Expand Down

0 comments on commit 4c518ab

Please sign in to comment.