snowFor: snowFor multithreading map-like function based on snow and...

Description Usage Arguments Examples

Description

Errors won't break the loop. Instead the loop will return an ThreadError object and keep going.

Usage

1
2
3
snowFor(x, FUN, pre_fun = NULL, varlist = NULL,
  cores = parallel::detectCores(), env = globalenv(), er = NULL,
  do_clean = T)

Arguments

x

list to loop. Accept vector, list and data.frame(by row)

FUN

the function for mapping

pre_fun

prepare function to init all nodes

varlist

name string vector of objects to be exported to nodes: "a_variable"

cores

number of threads

env

env to store the cl object. defalut: globalenv()

er

an EasyRedis object. (eg: er = EasyRedis::ErInit())

do_clean

if er != NULL and do_clean = T, then clean SnowFor information in Redis.

Examples

1
2
3
4
5
go_fun = function(x){
  Sys.sleep(1)
  x
 }
a = snowFor(1:10,go_fun,cores = 2)

itsaquestion/SnowFor documentation built on May 23, 2019, 7:18 a.m.