Skip to content

Commit

Permalink
CLI options --parallel=n now sets a 'multisession' plan; was 'multipr…
Browse files Browse the repository at this point in the history
…ocess' [#420]
  • Loading branch information
HenrikBengtsson committed Oct 29, 2020
1 parent 88e1478 commit 4d0b765
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: future
===============

Version: 1.19.1-9000 [2020-10-24]
Version: 1.19.1-9000 [2020-10-29]

SIGNIFICANT CHANGES:

Expand All @@ -10,6 +10,10 @@ SIGNIFICANT CHANGES:
will give an informative deprecation warning when 'multiprocess' is used.
This warning is given only once per R session.

* Launching R or Rscript with command-line option --parallel=n, where n > 1,
will now use 'multisession' as future strategy. Previously, it would use
'multiprocess', which is now deprecated.

* Support for 'local = FALSE' is deprecated. For the time being, it remains
supported for 'transparent' futures and 'cluster' futures that use
'persistent = TRUE'. However, note that 'persistent = TRUE' will also
Expand Down
2 changes: 1 addition & 1 deletion R/options.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#'
#' @section Options for controlling futures:
#' \describe{
#' \item{\option{future.plan}:}{(character string or future function) Default future strategy plan used unless otherwise specified via [plan()]. This will also be the future plan set when calling `plan("default")`. If not specified, this option may be set when the \pkg{future} package is _loaded_ if command-line option `--parallel=ncores` (short `-p ncores`) is specified; if `ncores > 1`, then option \option{future.plan} is set to `multiprocess` otherwise `sequential` (in addition to option \option{mc.cores} being set to `ncores`, if `ncores >= 1`). If system environment variable \env{R_FUTURE_PLAN} is set, then that overrides the future plan set by the command-line option. (Default: `sequential`)}
#' \item{\option{future.plan}:}{(character string or future function) Default future strategy plan used unless otherwise specified via [plan()]. This will also be the future plan set when calling `plan("default")`. If not specified, this option may be set when the \pkg{future} package is _loaded_ if command-line option `--parallel=ncores` (short `-p ncores`) is specified; if `ncores > 1`, then option \option{future.plan} is set to `multisession` otherwise `sequential` (in addition to option \option{mc.cores} being set to `ncores`, if `ncores >= 1`). If system environment variable \env{R_FUTURE_PLAN} is set, then that overrides the future plan set by the command-line option. (Default: `sequential`)}
#'
#' \item{\option{future.globals.maxSize}:}{(numeric) Maximum allowed total size (in bytes) of global variables identified. Used to prevent too large exports. If set of `+Inf`, then the check for large globals is skipped. (Default: `500 * 1024 ^ 2` = 500 MiB)}
#'
Expand Down
4 changes: 2 additions & 2 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
if (debug) mdebug(" => options(future.plan = sequential)")
options(future.plan = sequential)
} else {
if (debug) mdebugf(" => options(future.plan = tweak(multiprocess, workers = %s))", p)
options(future.plan = tweak(multiprocess, workers = p))
if (debug) mdebugf(" => options(future.plan = tweak(multisession, workers = %s))", p)
options(future.plan = tweak(multisession, workers = p))
}
}

Expand Down
2 changes: 1 addition & 1 deletion man/future.options.Rd

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

2 changes: 1 addition & 1 deletion vignettes/future-5-startup.md.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ then future will interpret this as we wish to resolve futures in parallel using
mc.cores
2
> class(future::plan())
[1] "tweaked" "multisession" "future" "function"
[1] "FutureStrategy" "tweaked" "multisession" "future" "function"
```

We can use this command-line option also with `Rscript`, which provides a convenient mechanism for launching future-enhanced R scripts such that they run in parallel, e.g.
Expand Down

0 comments on commit 4d0b765

Please sign in to comment.