A sequential future is a future that is evaluated sequentially in the current R session similarly to how R expressions are evaluated in R. The only difference to R itself is that globals are validated by default just as for all other types of futures in this package.

sequential(..., envir = parent.frame())

transparent(..., envir = parent.frame())

Arguments

...

Additional arguments passed to Future().

envir

The environment from where global objects should be identified.

Value

A SequentialFuture.

Details

This function is not meant to be called directly. Instead, the typical usages are:

# Evaluate futures sequentially in the current R process
plan(sequential)

transparent futures (troubleshooting only)

Transparent futures are sequential futures configured to emulate how R evaluates expressions as far as possible. For instance, errors and warnings are signaled immediately and assignments are done to the calling environment (without local() as default for all other types of futures). This makes transparent futures ideal for troubleshooting, especially when there are errors. WARNING: Transparent futures should only be used for debugging and troubleshooting. They should not be used for production pipelines and must not be set within another package. This is especially important since 'transparent' futures might be deprecated and replaced by better means of debugging in future releases.

Examples

## Use sequential futures plan(sequential) ## A global variable a <- 0 ## Create a sequential future f <- future({ b <- 3 c <- 2 a * b * c }) ## Since 'a' is a global variable in future 'f' which ## is eagerly resolved (default), this global has already ## been resolved / incorporated, and any changes to 'a' ## at this point will _not_ affect the value of 'f'. a <- 7 print(a)
#> [1] 7
v <- value(f) print(v)
#> [1] 0
stopifnot(v == 0)