sjspielman / dragon

Deep time Redox Analysis of the Geobiology Ontology Network
https://sjspielman.shinyapps.io/dragon/
Other
2 stars 1 forks source link

future::plan(multiprocess) to be deprecated; use 'multisession' / 'multicore' instead #43

Closed HenrikBengtsson closed 3 years ago

HenrikBengtsson commented 3 years ago

Hi, I'm deprecating the 'multiprocess' alias in the future package, cf. https://github.com/HenrikBengtsson/future/issues/420. You are using it:

https://github.com/sjspielman/dragon/blob/415bb6d9a62f9b9807c86789a1948b86128d0dad/R/utils_definitions.R#L7-L9

You can achieve the exact same thing by calling:

if (future::supportsMulticore()) {
  future::plan(future::multicore)
} else {
  future::plan(future::multisession)
}

That's actually the correct way to do it.

HenrikBengtsson commented 3 years ago

As I suggest in Issue #44, the best is to not set future::plan() at all.

FYI, I detected this because in the next version of future, using plan(multiprocess) triggers a deprecation warning. When running reverse-dependency checks, the dragon package produces a new R CMD check WARNING because:

* installing *source* package ‘dragon’ ...
** package ‘dragon’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Warning: Strategy 'multiprocess' is deprecated in future (>= 1.20.0). Instead, explicitly specify either 'multisession' or 'multicore'. In
 the current R session, 'multiprocess' equals 'multicore'.
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (dragon)
sjspielman commented 3 years ago

Thanks for pointing out. This will be updated in the next release.

HenrikBengtsson commented 3 years ago

I see that dragon 1.0.4 is on CRAN as of 2020-10-25. Unfortunately, this problem is still there;

$ wget https://cran.r-project.org/src/contrib/dragon_1.0.4.tar.gz
$ tar zxf dragon_1.0.4.tar.gz
$ head -10 R/utils_definitions.R 
## Options ---------------------------------------------------------------------------
original_options <- options(scipen=0, htmlwidgets.TOJSON_ARGS = NULL)
options(htmlwidgets.TOJSON_ARGS = list(na = 'string')) ## Setting for DT to show NA cells as NA rather than blank
options(scipen=3)                                      ## Sci when more than 3 digits
#on.exit(options(original_options), add=TRUE)

## Future planning with RStudio check to avoid warning -------------------------------
if (future::supportsMulticore()) future::plan(future::multiprocess) 
if (future::supportsMulticore() == FALSE) future::plan(future::multisession)
sjspielman commented 3 years ago

Thanks, not sure how this made it through. Been a challenging several months. Will address soon.

HenrikBengtsson commented 3 years ago

No worries. If you install the 'develop' version of the future package;

remotes::install_github("HenrikBengtsson/future", ref="develop")

before you R CMD check dragon_1.0.4.tar.gz, you should be able to reproduce the above warning we get during installation;

** byte-compile and prepare package for lazy loading
Warning: Strategy 'multiprocess' is deprecated in future (>= 1.20.0). Instead, explicitly specify either 'multisession' or 'multicore'. In
 the current R session, 'multiprocess' equals 'multicore'.

That should help you verify that it's gone for the next round.

sjspielman commented 3 years ago

That should help you verify that it's gone for the next round.

Good tip!!

HenrikBengtsson commented 3 years ago

Just a FYI. CRAN accepted the updated version of future 1.20.1. This means that 'dragon' now produces a WARNING on CRAN;

Version: 1.0.4
Check: whether package can be installed
Result: WARN
    Found the following significant warnings:
     Warning: Strategy 'multiprocess' is deprecated in future (>= 1.20.0). Instead, explicitly specify either 'multisession' or 'multicore'. In the current R session, 'multiprocess' equals 'multicore'.

Source: https://cran.r-project.org/web/checks/check_results_dragon.html

They might reach out to you separately; not sure how this works.

HenrikBengtsson commented 3 years ago

I see that this has now been fixed in dragon 1.0.5. Thxs.