Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove lazy since it has no effect #222

Merged
merged 2 commits into from May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
@@ -1,5 +1,9 @@
# furrr (development version)

* The `lazy` argument of `furrr_options()` has been completely removed. This
argument had no effect, as futures are always resolved before the
corresponding furrr function returns (#222).

* Condition objects are now dropped from future results before they are returned
to the main process (#216).

Expand Down
19 changes: 0 additions & 19 deletions R/furrr-options.R
Expand Up @@ -29,9 +29,6 @@
#' packages that are guaranteed to be attached in the R environment where the
#' future is evaluated.
#'
#' @param lazy A logical. Specifies whether futures should be resolved
#' lazily or eagerly.
#'
#' @param seed A logical, an integer of length `1` or `7`, a list of
#' `length(.x)` with pre-generated random seeds, or `NULL`. For details, see
#' the `Reproducible random number generation (RNG)` section below.
Expand Down Expand Up @@ -128,7 +125,6 @@ furrr_options <- function(...,
conditions = "condition",
globals = TRUE,
packages = NULL,
lazy = FALSE,
seed = FALSE,
scheduling = 1.0,
chunk_size = NULL,
Expand All @@ -139,7 +135,6 @@ furrr_options <- function(...,
conditions <- validate_conditions(conditions)
globals <- validate_globals(globals)
packages <- validate_packages(packages)
lazy <- validate_lazy(lazy)
seed <- validate_seed(seed)
scheduling <- validate_scheduling(scheduling)
chunk_size <- validate_chunk_size(chunk_size)
Expand All @@ -150,7 +145,6 @@ furrr_options <- function(...,
conditions = conditions,
globals = globals,
packages = packages,
lazy = lazy,
seed = seed,
scheduling = scheduling,
chunk_size = chunk_size,
Expand Down Expand Up @@ -184,15 +178,13 @@ print.furrr_options <- function(x, ...) {
future_options <- function(globals = TRUE,
packages = NULL,
seed = FALSE,
lazy = FALSE,
scheduling = 1.0) {
lifecycle::deprecate_warn("0.2.0", "future_options()", "furrr_options()")

furrr_options(
globals = globals,
packages = packages,
seed = seed,
lazy = lazy,
scheduling = scheduling
)
}
Expand Down Expand Up @@ -277,17 +269,6 @@ validate_packages <- function(x) {
x
}

validate_lazy <- function(x) {
vctrs::vec_assert(x, size = 1, arg = "lazy")
x <- vctrs::vec_cast(x, logical(), x_arg = "lazy")

if (is.na(x)) {
abort("`lazy` can't be `NA`.")
}

x
}

validate_seed <- function(x) {
if (is.null(x)) {
return(x)
Expand Down
1 change: 0 additions & 1 deletion R/template.R
Expand Up @@ -370,7 +370,6 @@ furrr_template <- function(args,
globals = chunk_globals,
packages = chunk_packages,
seed = options$seed,
lazy = options$lazy,
label = labels[[i]]
)
}
Expand Down
4 changes: 0 additions & 4 deletions man/furrr_options.Rd

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

11 changes: 1 addition & 10 deletions man/future_options.Rd

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

4 changes: 2 additions & 2 deletions tests/testthat/test-deprecation.R
Expand Up @@ -9,8 +9,8 @@ test_that("can use deprecated `future_options()`", {
)
expect_warning(
expect_identical(
future_options(globals = "x", packages = "dplyr", seed = 1, lazy = TRUE, scheduling = 2),
furrr_options(globals = "x", packages = "dplyr", seed = 1, lazy = TRUE, scheduling = 2)
future_options(globals = "x", packages = "dplyr", seed = 1, scheduling = 2),
furrr_options(globals = "x", packages = "dplyr", seed = 1, scheduling = 2)
)
)
})
Expand Down
14 changes: 0 additions & 14 deletions tests/testthat/test-furrr-options.R
Expand Up @@ -157,20 +157,6 @@ test_that("validates `conditions`", {
})
})

# ------------------------------------------------------------------------------
# furrr_options(lazy =)

furrr_test_that("can use lazy futures", {
opts <- furrr_options(lazy = TRUE)
expect_identical(future_map(1:5, ~.x, .options = opts), as.list(1:5))
})

test_that("validates `lazy`", {
expect_error(furrr_options(lazy = 2))
expect_error(furrr_options(lazy = NA))
expect_error(furrr_options(lazy = c(TRUE, FALSE)))
})

# ------------------------------------------------------------------------------
# furrr_options(seed =)

Expand Down