Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getExpression

Inject code for the next type of future to use for nested futures


Description

Inject code for the next type of future to use for nested futures

Usage

getExpression(future, ...)

Arguments

future

Current future.

...

Not used.

Details

If no next future strategy is specified, the default is to use sequential futures. This conservative approach protects against spawning off recursive futures by mistake, especially multicore and multisession ones. The default will also set options(mc.cores = 1L) (*) so that no parallel R processes are spawned off by functions such as parallel::mclapply() and friends.

Currently it is not possible to specify what type of nested futures to be used, meaning the above default will always be used. See Issue #37 for plans on adding support for custom nested future types.

(*) Ideally we would set mc.cores = 0 but that will unfortunately cause mclapply() and friends to generate an error saying "'mc.cores' must be >= 1". Ideally those functions should fall back to using the non-multicore alternative in this case, e.g. mclapply(...) => lapply(...). See https://github.com/HenrikBengtsson/Wishlist-for-R/issues/7 for a discussion on this.

Value

A future expression with code injected to set what type of future to use for nested futures, iff any.


future

Unified Parallel and Distributed Processing in R for Everyone

v1.21.0
LGPL (>= 2.1)
Authors
Henrik Bengtsson [aut, cre, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.