r - Tracing back rare error -
i'm running code takes long compute. made code parallel using foreach()%dopar% , run in on cluster.
it runs fine crashes , following error : error in { : task 4 failed - "missing value true/false needed" calls: %dopar% -> <anonymous> execution halted
now says execution halted particular core others keep running , @ end fails output doesn't tell me before hand. guess it's problem if statement. tried simulating code on computer rare can't simulate it.
the code runs 100 hours doing many 100 000 loops , 1 of them fail.
my questions : can traceback error was? (i run code on cluster don't have nice rstudio stuff)
also, possible still output foreach() loop if 1 of tasks crashed?
or perhaps method people use can make crash happen on computer?
i can write code if needed, please ask if helps.
the foreach ".errorhandling" argument intended in situation. if want foreach pass errors through, use .errorhandling="pass". if want filter out errors (which reduces length of result), use .errorhandling="remove". default value "stop" throws error indicating task failed.
unfortunately, parallel backends don't support tracebacks, dompi does. call "startmpicluster" verbose=true, , traceback written log file of worker had error. here's example generates error on task 42:
suppressmessages(library(dompi)) cl <- startmpicluster(4, verbose=true) registerdompi(cl) g <- function(i) { if (i == 42) { if (null) cat('hello, world\n') } 7 } f <- function(i) g(i) r <- foreach(i=1:50, .errorhandling='pass') %dopar% f(i) print(r) closecluster(cl) mpi.quit() since uses .errorhandling="pass", script runs completion, error object returned in element 42 of result list. in addition, 1 of log files contains traceback of error (along many other messages):
waiting taskchunk... executing taskchunk 42 containing 1 tasks error executing task: argument of length 0 traceback (most recent call first): > g(i) > f(i) > eval(expr, envir, enclos) > eval(expr, envir) > executetask(taskchunk$argslist[[1]]) > executetaskchunk(cl$workerid, taskchunk, envir, err, cores) returning error results taskchunk 42 unfortunately, dompi used on linux systems, isn't helpful mac , windows users.
Comments
Post a Comment