dear R experts---I am looking at a fairly uninformative error in my program: Error in mclapply(1:nrow(opts), solveme) : (converted from warning) all scheduled cores encountered errors in user code the doc on ?mclapply tells me that In addition, each process is running the job inside try(..., silent=TRUE) so if error occur they will be stored as try-error objects in the list. I looked up "try", but this manpage creates as many new riddles as it solves. so, it isn't obvious to me how I get to the try-error object list, or how to find out what triggered the abort. of course, I can use lapply to debug this, but this could be slow for some programs. (I know the answer for my problem is that a uniroot deep inside my code complained that my endpoints were not opposite.) in general, is there a way to get some more information from mclapply failures? could this be added to the docs for mclapply? /iaw ---- Ivo Welch (ivo.welch at gmail.com) http://www.ivo-welch.info/
parallel error message extraction (in mclapply)?
2 messages · ivo welch, Neal H. Walfield
Hi, Ivo, At Fri, 28 Dec 2012 16:34:03 -0800,
ivo welch wrote:
so, it isn't obvious to me how I get to the try-error object list, or how to find out what triggered the abort.
A try object is an object that captures the execution context at the
time of an error. Consider the following code:
> library(multicore)
> result = mclapply(1:10, function (i) { if (i == 4) foo() else i })
Warning message:
In mclapply(1:10, function(i) { :
scheduled core 4 encountered error in user code, all values of the job will be affected
To investigate the error, we can use the try object that has been
saved in position 4:
> print(result[[4]])
[1] "Error in FUN(4L[[1L]], ...) : could not find function \"foo\"\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in FUN(4L[[1L]], ...): could not find function "foo"
> traceback(result[[4]])
1: Error in FUN(4L[[1L]], ...) : could not find function "foo"
Neal