Skip to content

Commit 3e33ce8

Browse files
The 'future' package is now pre-loaded on the parallel workers when cluster workers are created
1 parent 9f87a5a commit 3e33ce8

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future
2-
Version: 1.58.0-9004
2+
Version: 1.58.0-9005
33
Title: Unified Parallel and Distributed Processing in R for Everyone
44
Depends:
55
R (>= 3.2.0)

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
launched was unnecessarily expensive due to a thinko, e.g. it would
77
take ~0.1-0.2 seconds for a multisession future, whereas after the
88
fix it is effectly 0.0 seconds.
9+
10+
* The **future** package is now pre-loaded on the parallel workers as
11+
soon as a new cluster or multisession future backend is set
12+
up. Previously, it was loaded with the first future being evaluated
13+
on a worker.
914

1015
* Calling `resolved()` on a lazy `ClusterFuture` would collect the
1116
result for the first _resolved_ future in order to free up one

R/backend_api-11.ClusterFutureBackend-class.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ launchFuture.ClusterFutureBackend <- function(backend, future, ...) {
209209
## Get the index of a free cluster node, which has been validated to
210210
## be functional. If the existing worker was found to be non-functional,
211211
## it was re-launched by requestNode()
212+
## FIXME: Is this wrong? Does it get the future-registry slot index
213+
## rather than worker index? /HB 2025-07-04
212214
node_idx <- requestNode(await = function() {
213215
FutureRegistry(reg, action = "collect-first", earlySignal = TRUE, debug = debug)
214216
}, backend = backend, timeout = timeout, delta = delta, alpha = alpha)
@@ -473,6 +475,10 @@ nbrOfFreeWorkers.ClusterFutureBackend <- function(evaluator, ...) {
473475

474476
cl <- do.call(makeClusterPSOCK, args = args, quote = TRUE)
475477
cl <- addCovrLibPath(cl)
478+
479+
## Pre-attach 'future' package
480+
void <- clusterCall(cl = cl, fun = requireNamespace, "future", quietly = TRUE)
481+
476482
cl
477483
} ## .makeCluster()
478484

0 commit comments

Comments
 (0)