Skip to content

Commit

Permalink
DEPRECATION: Be more agressive about 'multiprocess' deprecation warni…
Browse files Browse the repository at this point in the history
…ngs (related to #420)
  • Loading branch information
HenrikBengtsson committed Apr 27, 2022
1 parent 9d64acf commit e8d3e3a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 28 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: future
Version: 1.25.0-9001
Version: 1.25.0-9002
Title: Unified Parallel and Distributed Processing in R for Everyone
Imports:
digest,
Expand Down
15 changes: 8 additions & 7 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
Package: future
===============

Version: 1.25.0-9001 [2022-04-27]
Version: 1.25.0-9002 [2022-04-27]

DEPRECATED AND DEFUNCT:

* Strategy 'remote' and 'transparent' were deprecated in future
1.24.0, where attempts to use them in plan() would produce a
deprecation warning, which was limited to one per R session.
Starting with this release, this warning is now produced whenever
using `plan()` with these deprecated future strategies'.

* Strategy 'multiprocess' was deprecated in future 1.20.0, and
'remote' and 'transparent' were deprecated in future 1.24.0. Since
then, attempts to use them in plan() would produce a deprecation
warning, which was limited to one per R session. Starting with
this release, this warning is now produced whenever using `plan()`
with these deprecated future strategies.


Version: 1.25.0 [2022-04-23]

Expand Down
31 changes: 11 additions & 20 deletions R/zzz.plan.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,35 +161,26 @@ plan <- local({
FALSE
}

warn_about_multiprocess <- local({
.warn <- TRUE

function(stack) {
if (!.warn) return()

## Is deprecated 'multiprocess' used?
for (kk in seq_along(stack)) {
if (evaluator_uses(stack[[kk]], "multiprocess")) {
ignore <- getOption("future.deprecated.ignore")
if (!is.element("multiprocess", ignore)) {
## Warn only once
.warn <<- FALSE
.Deprecated(msg = sprintf("Strategy 'multiprocess' is deprecated in future (>= 1.20.0). Instead, explicitly specify either 'multisession' or 'multicore'. In the current R session, 'multiprocess' equals '%s'.", if (supportsMulticore()) "multicore" else "multisession"), package = .packageName)
}

break
warn_about_multiprocess <- function(stack) {
## Is deprecated 'multiprocess' used?
for (kk in seq_along(stack)) {
if (evaluator_uses(stack[[kk]], "multiprocess")) {
ignore <- getOption("future.deprecated.ignore")
if (!is.element("multiprocess", ignore)) {
.Deprecated(msg = sprintf("Strategy 'multiprocess' is deprecated in future (>= 1.20.0) [2020-10-30] and will soon become defunct. Instead, explicitly specify either 'multisession' (recommended) or 'multicore'. In the current R session, 'multiprocess' equals '%s'.", if (supportsMulticore()) "multicore" else "multisession"), package = .packageName)
}
break
}
}
})
}

warn_about_remote <- function(stack) {
## Is 'remote' used?
for (kk in seq_along(stack)) {
if (evaluator_uses(stack[[kk]], "remote")) {
ignore <- getOption("future.deprecated.ignore")
if (!is.element("remote", ignore)) {
.Deprecated(msg = "Strategy 'remote' is deprecated in future (>= 1.24.0). Instead, use 'cluster'.", package = .packageName)
.Deprecated(msg = "Strategy 'remote' is deprecated in future (>= 1.24.0) [2022-02-19] and will soon become defunct. Instead, use 'cluster'.", package = .packageName)
}
}
}
Expand All @@ -201,7 +192,7 @@ plan <- local({
if (evaluator_uses(stack[[kk]], "transparent")) {
ignore <- getOption("future.deprecated.ignore")
if (!is.element("remote", ignore)) {
.Deprecated(msg = "Strategy 'transparent' is deprecated in future (>= 1.24.0) and will soon become defunct. It was designed to simplify interactive troubleshooting, but is now superseeded by plan(sequential, split = TRUE).", package = .packageName)
.Deprecated(msg = "Strategy 'transparent' is deprecated in future (>= 1.24.0) [2022-02-19] and will soon become defunct. It was designed to simplify interactive troubleshooting, but is now superseeded by plan(sequential, split = TRUE).", package = .packageName)
}
break
}
Expand Down

0 comments on commit e8d3e3a

Please sign in to comment.