Thank you Simon, this is helpful. I take this is specific to quit(),
so it's a poor choice for emulating crashed parallel workers, and
Sys.kill() is much better for that.
I was focusing on that odd extra execution/output, but as you say,
there are lots of other things that is done by quit() here, e.g.
regardless of platform quit() damages the main R process too:
> f <- parallel::mcparallel(quit("no"))
> v <- parallel::mccollect(f)
Warning message:
In parallel::mccollect(f) : 1 parallel job did not deliver a result
> file.exists(tempdir())
[1] FALSE
Would it be sufficient to make quit() fork safe by, conceptually,
doing something like:
quit <- function(save = "default", status = 0, runLast = TRUE) {
if (parallel:::isChild())
stop("quit() must not be called in a forked process")
.Internal(quit(save, status, runLast))
}
This would protect against calling quit() in forked code by mistake,
e.g. when someone parallelize over code/scripts they don't have full
control over and the ones who write those scripts might not be aware
that they may be used in forks.
Thanks,
Henrik
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel