Get the future of a future variable that has been created directly or indirectly via future().

futureOf(
  var = NULL,
  envir = parent.frame(),
  mustExist = TRUE,
  default = NA,
  drop = FALSE
)

Arguments

var

the variable. If NULL, all futures in the environment are returned.

envir

the environment where to search from.

mustExist

If TRUE and the variable does not exists, then an informative error is thrown, otherwise NA is returned.

default

the default value if future was not found.

drop

if TRUE and var is NULL, then returned list only contains futures, otherwise also default values.

Value

A Future (or default). If var is NULL, then a named list of Future:s are returned.

Examples

a %<-% { 1 } f <- futureOf(a) print(f)
#> SequentialFuture: #> Label: ‘<none>’ #> Expression: #> { #> 1 #> } #> Lazy evaluation: FALSE #> Asynchronous evaluation: FALSE #> Local evaluation: TRUE #> Environment: 0x5585f5b56b80 #> Capture standard output: TRUE #> Capture condition classes: ‘condition’ (excluding ‘nothing’) #> Globals: <none> #> Packages: <none> #> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE) #> Resolved: TRUE #> Value: 56 bytes of class ‘numeric’ #> Early signaling: FALSE #> Owner process: bddd9f18-6b69-04c7-1ed1-c6f0a55b01fb #> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
b %<-% { 2 } f <- futureOf(b) print(f)
#> SequentialFuture: #> Label: ‘<none>’ #> Expression: #> { #> 2 #> } #> Lazy evaluation: FALSE #> Asynchronous evaluation: FALSE #> Local evaluation: TRUE #> Environment: 0x5585f5b56b80 #> Capture standard output: TRUE #> Capture condition classes: ‘condition’ (excluding ‘nothing’) #> Globals: <none> #> Packages: <none> #> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE) #> Resolved: TRUE #> Value: 56 bytes of class ‘numeric’ #> Early signaling: FALSE #> Owner process: bddd9f18-6b69-04c7-1ed1-c6f0a55b01fb #> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
## All futures fs <- futureOf() print(fs)
#> $a #> SequentialFuture: #> Label: ‘<none>’ #> Expression: #> { #> 1 #> } #> Lazy evaluation: FALSE #> Asynchronous evaluation: FALSE #> Local evaluation: TRUE #> Environment: 0x5585f5b56b80 #> Capture standard output: TRUE #> Capture condition classes: ‘condition’ (excluding ‘nothing’) #> Globals: <none> #> Packages: <none> #> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE) #> Resolved: TRUE #> Value: 56 bytes of class ‘numeric’ #> Early signaling: FALSE #> Owner process: bddd9f18-6b69-04c7-1ed1-c6f0a55b01fb #> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’ #> #> $b #> SequentialFuture: #> Label: ‘<none>’ #> Expression: #> { #> 2 #> } #> Lazy evaluation: FALSE #> Asynchronous evaluation: FALSE #> Local evaluation: TRUE #> Environment: 0x5585f5b56b80 #> Capture standard output: TRUE #> Capture condition classes: ‘condition’ (excluding ‘nothing’) #> Globals: <none> #> Packages: <none> #> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE) #> Resolved: TRUE #> Value: 56 bytes of class ‘numeric’ #> Early signaling: FALSE #> Owner process: bddd9f18-6b69-04c7-1ed1-c6f0a55b01fb #> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’ #> #> $f #> SequentialFuture: #> Label: ‘<none>’ #> Expression: #> { #> 2 #> } #> Lazy evaluation: FALSE #> Asynchronous evaluation: FALSE #> Local evaluation: TRUE #> Environment: 0x5585f5b56b80 #> Capture standard output: TRUE #> Capture condition classes: ‘condition’ (excluding ‘nothing’) #> Globals: <none> #> Packages: <none> #> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE) #> Resolved: TRUE #> Value: 56 bytes of class ‘numeric’ #> Early signaling: FALSE #> Owner process: bddd9f18-6b69-04c7-1ed1-c6f0a55b01fb #> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’ #>
## Futures part of environment env <- new.env() env$c %<-% { 3 } f <- futureOf(env$c) print(f)
#> SequentialFuture: #> Label: ‘<none>’ #> Expression: #> { #> 3 #> } #> Lazy evaluation: FALSE #> Asynchronous evaluation: FALSE #> Local evaluation: TRUE #> Environment: 0x5585f5b56b80 #> Capture standard output: TRUE #> Capture condition classes: ‘condition’ (excluding ‘nothing’) #> Globals: <none> #> Packages: <none> #> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE) #> Resolved: TRUE #> Value: 56 bytes of class ‘numeric’ #> Early signaling: FALSE #> Owner process: bddd9f18-6b69-04c7-1ed1-c6f0a55b01fb #> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
f2 <- futureOf(c, envir = env) print(f2)
#> SequentialFuture: #> Label: ‘<none>’ #> Expression: #> { #> 3 #> } #> Lazy evaluation: FALSE #> Asynchronous evaluation: FALSE #> Local evaluation: TRUE #> Environment: 0x5585f5b56b80 #> Capture standard output: TRUE #> Capture condition classes: ‘condition’ (excluding ‘nothing’) #> Globals: <none> #> Packages: <none> #> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE) #> Resolved: TRUE #> Value: 56 bytes of class ‘numeric’ #> Early signaling: FALSE #> Owner process: bddd9f18-6b69-04c7-1ed1-c6f0a55b01fb #> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
f3 <- futureOf("c", envir = env) print(f3)
#> SequentialFuture: #> Label: ‘<none>’ #> Expression: #> { #> 3 #> } #> Lazy evaluation: FALSE #> Asynchronous evaluation: FALSE #> Local evaluation: TRUE #> Environment: 0x5585f5b56b80 #> Capture standard output: TRUE #> Capture condition classes: ‘condition’ (excluding ‘nothing’) #> Globals: <none> #> Packages: <none> #> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE) #> Resolved: TRUE #> Value: 56 bytes of class ‘numeric’ #> Early signaling: FALSE #> Owner process: bddd9f18-6b69-04c7-1ed1-c6f0a55b01fb #> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
fs <- futureOf(envir = env) print(fs)
#> $c #> SequentialFuture: #> Label: ‘<none>’ #> Expression: #> { #> 3 #> } #> Lazy evaluation: FALSE #> Asynchronous evaluation: FALSE #> Local evaluation: TRUE #> Environment: 0x5585f5b56b80 #> Capture standard output: TRUE #> Capture condition classes: ‘condition’ (excluding ‘nothing’) #> Globals: <none> #> Packages: <none> #> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE) #> Resolved: TRUE #> Value: 56 bytes of class ‘numeric’ #> Early signaling: FALSE #> Owner process: bddd9f18-6b69-04c7-1ed1-c6f0a55b01fb #> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’ #>