setExport: setExport

Description Usage Arguments Details Value Author(s) Examples

View source: R/doRedis.R

Description

Manually add symbol names to the worker environment export list.

Usage

1

Arguments

names

A vector of symbol names to export.

Details

The setExport function lets users manually declare symbol names of corresponding objects that should be exported to workers.

The foreach function includes a similar .export parameter.

We provide this supplemental export option for users without direct access to the foreach function, for example, when foreach is used within a package.

Value

Nothing is returned.

Author(s)

B. W. Lewis <blewis@illposed.net>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
require("doRedis")
registerDoRedis("work queue")
startLocalWorkers(n=1, queue="work queue")

f <- function() pi

foreach(1) 
# Returns the error:
# Error in eval(call("f")) : task 1 failed - could not find function "f"

# Manuall export the symbol f:
setExport("f")
foreach(1) 
# Ok then.
#[[1]]
#[1] 3.141593
removeQueue("work queue")

## End(Not run)

cloudcell/doRedis111stable documentation built on May 13, 2019, 8:02 p.m.