[R] Snowfall - Error in checkForRemoteErrors(val) with sfClusterApplyLB()

Marine Regis marine.regis at hotmail.fr
Thu Apr 28 19:57:16 CEST 2016


Hello,



I'm trying to run a code that uses the snowfall package. Here is the structure of my code.



sfInit(parallel=T, cpus = 5, slaveOutfile="ErrorMessage.txt")

sfExportAll()

sfLibrary(rgdal)

sfLibrary(raster)

sfLibrary(sp)

sfLibrary(rgeos)

sfLibrary(snowfall)



system.time( sfClusterApplyLB(1:10, function(k) {

  sfCat(paste("Iteration ", k), sep="\n")

if (......) {

} else {

if (class(ob1)=="SpatialCollections") {

        ob2 <- ob1 at lineobj

      } else if (class(ob1)=="SpatialLines") {

        ob2 <- ob1

      }

ob3 <- data.frame(length_m=sapply(1:length(ob2), function(l) gLength(ob2 [l, ])))

.....

}

.....

}

sfStop()



The problem is that the code returns the error message:

Error in checkForRemoteErrors(val) :

  one node produced an error: object 'ob2' not found



>From the debugging function "sfCat", I also get these warning messages:



Warning messages:

1: In searchCommandline(parallel, cpus = cpus, type = type, socketHosts = socketHosts,  :

  Unknown option on commandline: --file

2: In searchCommandline(parallel, cpus = cpus, type = type, socketHosts = socketHosts,  :

  Unknown option on commandline: MASTER

3: In searchCommandline(parallel, cpus = cpus, type = type, socketHosts = socketHosts,  :

  Unknown option on commandline: PORT

4: In searchCommandline(parallel, cpus = cpus, type = type, socketHosts = socketHosts,  :

  Unknown option on commandline: OUT

5: In searchCommandline(parallel, cpus = cpus, type = type, socketHosts = socketHosts,  :

  Unknown option on commandline: SNOWLIB

 socketHosts,  :

  Unknown option on commandline: SNOWLIB

tion on commandline: SNOWLIB


The code works when I use a simple loop for(k in 1:10) {} instead of sfClusterApplyLB(1:10, function(k) {}.



Why do I obtain this error message ? I am completely novice in using snowfall package. So any advices are appreciated.



Thanks a lot for your time.


Marine


	[[alternative HTML version deleted]]



More information about the R-help mailing list