Skip to content

Commit 8a279cc

Browse files
BUG FIX: Globals found to be non-resolved futures were not automatically resolved with options(future.globals.resolve = TRUE)
1 parent 548d7a2 commit 8a279cc

3 files changed

Lines changed: 20 additions & 10 deletions

File tree

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.69.0-9019
2+
Version: 1.69.0-9020
33
Title: Unified Parallel and Distributed Processing in R for Everyone
44
Depends:
55
R (>= 3.2.0)

NEWS.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@
1616

1717
## Bug Fixes
1818

19+
* The search for globals would not fall back to the "ordered"
20+
algorithm as intended when "deep-first-search" failed.
21+
22+
* Globals found to be non-resolved futures were not automatically
23+
resolved with `options(future.globals.resolve = TRUE)`.
24+
1925
* Cancellation of 'multisession' futures could produce a warning on
2026
"In .Internal(gc(verbose, reset, full)) : closing unused connection
2127
3 (<-localhost:11825)".
22-
23-
* The search for globals would not fall back to the "ordered"
24-
algorithm as intended when "deep-first-search" failed.
28+
2529

2630

2731
# Version 1.69.0 [2026-01-15]

R/protected_api-globals.R

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,21 @@ getGlobalsAndPackages <- function(expr, envir = parent.frame(), tweak = tweakExp
315315
globals <- as.FutureGlobals(globals)
316316

317317
## Unless already resolved, perform a shallow resolve
318-
if (attr(globals, "resolved", exact = TRUE)) {
319-
idxs <- which(unlist(lapply(globals, FUN = inherits, "Future"), use.names = FALSE))
320-
if (debug) mdebugf("Number of global futures: %d", length(idxs))
318+
if (!attr(globals, "resolved", exact = TRUE)) {
319+
idxs <- which(unlist(lapply(globals, FUN = function(g) {
320+
inherits(g, "Future") && !inherits(g, "ConstantFuture")
321+
}), use.names = FALSE))
322+
if (debug) mdebugf("Number of non-constant global futures: %d", length(idxs))
321323

322324
## Nothing to do?
323325
if (length(idxs) > 0) {
324-
if (debug) mdebugf("Global futures (not constant): %s", commaq(names(globals[idxs])))
325-
valuesF <- value(globals[idxs])
326-
globals[idxs] <- lapply(valuesF, FUN = ConstantFuture)
326+
gnames <- names(globals)[idxs]
327+
if (debug) mdebugf("Global futures (not constant): %s", commaq(gnames))
328+
## FIXME: value(globals[gnames]) fails because of
329+
## https://github.com/futureverse/globals/issues/101
330+
gvalues <- lapply(globals[gnames], FUN = value)
331+
gvalues <- lapply(gvalues, FUN = ConstantFuture)
332+
globals[gnames] <- gvalues
327333
}
328334
}
329335

0 commit comments

Comments
 (0)