From 4fd6d4cdb6c76cf331c6474281030ee9683fa415 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 30 Dec 2020 18:32:13 -0500 Subject: [PATCH 1/2] Do not use `plan(multiprocess)`. Instead, use `plan(multisession)` --- inst/plumber/14-future/plumber.R | 4 ++-- inst/plumber/14-future/test-future.R | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/inst/plumber/14-future/plumber.R b/inst/plumber/14-future/plumber.R index 3d057bd69..b7f9a797e 100644 --- a/inst/plumber/14-future/plumber.R +++ b/inst/plumber/14-future/plumber.R @@ -2,8 +2,8 @@ library(promises) library(future) -future::plan("multiprocess") # use all available cores -# future::plan(future::multiprocess(workers = 2)) # only two cores +future::plan("multisession") # a worker for each core +# future::plan(future::multisession(workers = 2)) # only two workers # Quick manual test: # Within 10 seconds... diff --git a/inst/plumber/14-future/test-future.R b/inst/plumber/14-future/test-future.R index ee941ece4..58d635f96 100644 --- a/inst/plumber/14-future/test-future.R +++ b/inst/plumber/14-future/test-future.R @@ -69,7 +69,7 @@ cat(readLines(log_file), sep = "\n") })) # -------------------------- -## Sample output using future::plan(future::multiprocess(workers = 2)) # only two cores +## Sample output using future::plan(future::multisession(workers = 2)) # only two workers # --START route requests # "/sync; 2019-10-07 13:11:06; pid:82424" - 1 # "/sync; 2019-10-07 13:11:07; pid:82424" - 3 @@ -88,7 +88,7 @@ cat(readLines(log_file), sep = "\n") # -------------------------- -## Sample output using future::plan("multiprocess") # use all available cores +## Sample output using future::plan("multisession") # a worker for each core # --START route requests # "/sync; 2019-10-07 13:16:22; pid:82424" - 1 # "/sync; 2019-10-07 13:16:23; pid:82424" - 3 From 5f236d8e668e6d41e85c8a0a98f0dec1af765d35 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 30 Dec 2020 18:34:45 -0500 Subject: [PATCH 2/2] Update NEWS.md --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 2c0012f94..c7a64c04e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -36,6 +36,8 @@ plumber 1.0.0.9999 Development version * Plumber will now display a circular reference if one is found while printing. (#738) +* Changed `future::plan()` from `multiprocess` to `multisession` in example API `14-future` as "Strategy 'multiprocess' is deprecated in future (>= 1.20.0)". (#747) + plumber 1.0.0 --------------------------------------------------------------------------------