futureOf: Get the future of a future variable

Description Usage Arguments Value Examples

View source: R/futureOf.R

Description

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

Usage

1
2
3
4
5
6
7
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
a %<-% { 1 }

f <- futureOf(a)
print(f)

b %<-% { 2 }

f <- futureOf(b)
print(f)

## All futures
fs <- futureOf()
print(fs)


## Futures part of environment
env <- new.env()
env$c %<-% { 3 }

f <- futureOf(env$c)
print(f)

f2 <- futureOf(c, envir = env)
print(f2)

f3 <- futureOf("c", envir = env)
print(f3)

fs <- futureOf(envir = env)
print(fs)

Example output

SequentialFuture:
Label:<none>Expression:
{
    1
}
Lazy evaluation: FALSE
Asynchronous evaluation: FALSE
Local evaluation: TRUE
Environment: R_GlobalEnv
Capture standard output: TRUE
Capture condition classes:conditionGlobals: <none>
Packages: <none>
L'Ecuyer-CMRG RNG seed: <none> (seed = NULL)
Resolved: TRUE
Value: 56 bytes of class ‘numeric’
Early signaling: FALSE
Owner process: 690761bb-20ce-bcb0-0837-fbac43cc84ac
Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
SequentialFuture:
Label: ‘<none>’
Expression:
{
    2
}
Lazy evaluation: FALSE
Asynchronous evaluation: FALSE
Local evaluation: TRUE
Environment: R_GlobalEnv
Capture standard output: TRUE
Capture condition classes: ‘condition’
Globals: <none>
Packages: <none>
L'Ecuyer-CMRG RNG seed: <none> (seed = NULL)
Resolved: TRUE
Value: 56 bytes of classnumericEarly signaling: FALSE
Owner process: 690761bb-20ce-bcb0-0837-fbac43cc84ac
Class:SequentialFuture,UniprocessFuture,Future,environment$...future.conditions
[1] NA
attr(,"reason")
[1] "Future (‘...future.conditions’) not found in environment ‘R_GlobalEnv’: ‘\"...future.conditions\"’"

$...future.frame
[1] NA
attr(,"reason")
[1] "Future (‘...future.frame’) not found in environment ‘R_GlobalEnv’: ‘\"...future.frame\"’"

$...future.oldOptions
[1] NA
attr(,"reason")
[1] "Future (‘...future.oldOptions’) not found in environment ‘R_GlobalEnv’: ‘\"...future.oldOptions\"’"

$...future.result
[1] NA
attr(,"reason")
[1] "Future (‘...future.result’) not found in environment ‘R_GlobalEnv’: ‘\"...future.result\"’"

$...future.rng
[1] NA
attr(,"reason")
[1] "Future (‘...future.rng’) not found in environment ‘R_GlobalEnv’: ‘\"...future.rng\"’"

$...future.startTime
[1] NA
attr(,"reason")
[1] "Future (‘...future.startTime’) not found in environment ‘R_GlobalEnv’: ‘\"...future.startTime\"’"

$...future.stdout
[1] NA
attr(,"reason")
[1] "Future (‘...future.stdout’) not found in environment ‘R_GlobalEnv’: ‘\"...future.stdout\"’"

$...future.value
[1] NA
attr(,"reason")
[1] "Future (‘...future.value’) not found in environment ‘R_GlobalEnv’: ‘\"...future.value\"’"

$.packageVersion
[1] NA
attr(,"reason")
[1] "Future (‘.packageVersion’) not found in environment ‘R_GlobalEnv’: ‘\".packageVersion\"’"

$a
SequentialFuture:
Label:<none>Expression:
{
    1
}
Lazy evaluation: FALSE
Asynchronous evaluation: FALSE
Local evaluation: TRUE
Environment: R_GlobalEnv
Capture standard output: TRUE
Capture condition classes:conditionGlobals: <none>
Packages: <none>
L'Ecuyer-CMRG RNG seed: <none> (seed = NULL)
Resolved: TRUE
Value: 56 bytes of class ‘numeric’
Early signaling: FALSE
Owner process: 690761bb-20ce-bcb0-0837-fbac43cc84ac
Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’

$b
SequentialFuture:
Label: ‘<none>’
Expression:
{
    2
}
Lazy evaluation: FALSE
Asynchronous evaluation: FALSE
Local evaluation: TRUE
Environment: R_GlobalEnv
Capture standard output: TRUE
Capture condition classes: ‘condition’
Globals: <none>
Packages: <none>
L'Ecuyer-CMRG RNG seed: <none> (seed = NULL)
Resolved: TRUE
Value: 56 bytes of classnumericEarly signaling: FALSE
Owner process: 690761bb-20ce-bcb0-0837-fbac43cc84ac
Class:SequentialFuture,UniprocessFuture,Future,environment$f
SequentialFuture:
Label:<none>Expression:
{
    2
}
Lazy evaluation: FALSE
Asynchronous evaluation: FALSE
Local evaluation: TRUE
Environment: R_GlobalEnv
Capture standard output: TRUE
Capture condition classes:conditionGlobals: <none>
Packages: <none>
L'Ecuyer-CMRG RNG seed: <none> (seed = NULL)
Resolved: TRUE
Value: 56 bytes of class ‘numeric’
Early signaling: FALSE
Owner process: 690761bb-20ce-bcb0-0837-fbac43cc84ac
Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’

SequentialFuture:
Label: ‘<none>’
Expression:
{
    3
}
Lazy evaluation: FALSE
Asynchronous evaluation: FALSE
Local evaluation: TRUE
Environment: R_GlobalEnv
Capture standard output: TRUE
Capture condition classes: ‘condition’
Globals: <none>
Packages: <none>
L'Ecuyer-CMRG RNG seed: <none> (seed = NULL)
Resolved: TRUE
Value: 56 bytes of classnumericEarly signaling: FALSE
Owner process: 690761bb-20ce-bcb0-0837-fbac43cc84ac
Class:SequentialFuture,UniprocessFuture,Future,environmentSequentialFuture:
Label:<none>Expression:
{
    3
}
Lazy evaluation: FALSE
Asynchronous evaluation: FALSE
Local evaluation: TRUE
Environment: R_GlobalEnv
Capture standard output: TRUE
Capture condition classes:conditionGlobals: <none>
Packages: <none>
L'Ecuyer-CMRG RNG seed: <none> (seed = NULL)
Resolved: TRUE
Value: 56 bytes of class ‘numeric’
Early signaling: FALSE
Owner process: 690761bb-20ce-bcb0-0837-fbac43cc84ac
Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
SequentialFuture:
Label: ‘<none>’
Expression:
{
    3
}
Lazy evaluation: FALSE
Asynchronous evaluation: FALSE
Local evaluation: TRUE
Environment: R_GlobalEnv
Capture standard output: TRUE
Capture condition classes: ‘condition’
Globals: <none>
Packages: <none>
L'Ecuyer-CMRG RNG seed: <none> (seed = NULL)
Resolved: TRUE
Value: 56 bytes of classnumericEarly signaling: FALSE
Owner process: 690761bb-20ce-bcb0-0837-fbac43cc84ac
Class:SequentialFuture,UniprocessFuture,Future,environment$c
SequentialFuture:
Label:<none>Expression:
{
    3
}
Lazy evaluation: FALSE
Asynchronous evaluation: FALSE
Local evaluation: TRUE
Environment: R_GlobalEnv
Capture standard output: TRUE
Capture condition classes:conditionGlobals: <none>
Packages: <none>
L'Ecuyer-CMRG RNG seed: <none> (seed = NULL)
Resolved: TRUE
Value: 56 bytes of classnumericEarly signaling: FALSE
Owner process: 690761bb-20ce-bcb0-0837-fbac43cc84ac
Class:SequentialFuture,UniprocessFuture,Future,environment

future documentation built on Jan. 8, 2021, 5:36 p.m.

Related to futureOf in future...