[R-sig-Geo] Error in checkForRemoteErrors(val) with sfClusterApplyLB()
Roger Bivand
Roger.Bivand at nhh.no
Fri Apr 29 09:45:32 CEST 2016
On Thu, 28 Apr 2016, Marine Regis wrote:
> Hello,
>
> I'm trying to run a code that uses the snowfall package. Here is the
> structure of my code.
Avoid snowfall unless you know that the code runs in general. The problem
seems to be with your if conditions - you assume that ob1 is either a
SpatialCollections object and has a lineobj slot, or that ob1 is a
SpatialLines object, in both cases yielding ob2 as a SpatialLines object.
You do not check that ob1 is neither SpatialLines nor SpatialCollections,
or if SpatialCollections that it has a lineobj slot. You need a further
step where ob2 is initialised as NULL, and tested after the attempts to
assign lines, branching on is.null(ob2).
Your data are likely not the same as those of the authors of the code you
are trying to run, and they didn't write to take account of situations
they didn't encounter.
Roger
>
> 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]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
http://depsy.org/person/434412
More information about the R-sig-Geo
mailing list