Learn R Programming

nws (version 1.7.0.0)

sleigh: Class ``sleigh"

Description

Represents a collection of R processes used to execute tasks.

The sleigh allows R functions to be executed in parallel using the eachElem and eachWorker methods.

The sleigh workers are started when the sleigh object is constructed. When tasks are submitted to the sleigh, using the eachWorker and eachElem methods, the workers execute the tasks and return the results. When the stopSleigh method is called, the workers are stopped.

A given R program can create multiple sleigh objects, each of which will have its own set of workers. This can be useful if tasks have different requirements. For example, you could create a Linux sleigh and a Windows sleigh, and submit Windows-specific tasks only to your Windows sleigh.

Arguments

Details

There are six different standard launch types ('local', sshcmd, rshcmd, lsfcmd, sshforwardcmd, and 'web') to tailor the client's working environment. This is done by setting launch variable to a function (sshcmd, rshcmd, sshforwardcmd or lsfcmd) or a string ('local' and 'web'). See the examples section.

Examples

Run this code
# Default option: create three sleigh workers on local host:
s <- sleigh()
# which is equivalent to:
s <- sleigh(launch='local')

# Create sleigh workers on multiple machines using SSH:
s <- sleigh(nodeList=c('n1', 'n2', 'n3'), launch=sshcmd)

# Use the LSF bsub command to launch ten workers:
s <- sleigh(nodeList=rep('fake', 10), launch=lsfcmd)

# Use web launch:
s <- sleigh(launch='web')

Run the code above in your browser using DataLab