Evaluate an expression 'everywhere' on all connected daemons for the specified compute profile. Designed for performing setup operations across daemons or exporting common data, resultant changes to the global environment, loaded packages or options are persisted regardless of a daemon's 'cleanup' setting.

everywhere(.expr, ..., .args = list(), .compute = "default")

Arguments

.expr

an expression to evaluate asynchronously (of arbitrary length, wrapped in { } where necessary), or else a pre-constructed language object.

...

(optional) either named arguments (name = value pairs) specifying objects referenced in '.expr', or an environment. These objects (from the environment if one was supplied) are placed in the global environment of the evaluation process.

.args

(optional) either a list of name = value pairs, or an environment, as in '...' above. Contrary to '...', these objects remain local to the evaluation environment.

.compute

[default 'default'] character value for the compute profile to use (each compute profile has its own independent set of daemons).

Value

Invisible NULL.

Examples

if (interactive()) {
# Only run examples in interactive R sessions

daemons(1)
# export common data by a super-assignment expression:
everywhere(y <<- 3)
# '...' variables are assigned to the global environment:
everywhere({}, a = 1, b = 2)
m <- mirai(a + b - y == 0L)
call_mirai(m)$data
daemons(0)

daemons(1, dispatcher = FALSE)
everywhere(library(parallel))
m <- mirai("package:parallel" %in% search())
call_mirai(m)$data
daemons(0)

}