BiocParallel icon indicating copy to clipboard operation
BiocParallel copied to clipboard

ROBUSTNESS: Detect when forked process terminates

Open HenrikBengtsson opened this issue 5 years ago • 0 comments

Related to Issue #111, I'd like to suggest that you add a layer that detects when a forked process dies, which results in no results for parallel::mccollect(), and give an informative error message.

Example of the problem:

> library(BiocParallel)
> bplapply(1:2, FUN = function(x) quit("no"), BPPARAM = MulticoreParam(2L))
Error in result[[njob]] <- value : 
  attempt to select less than one element in OneIndex
2: In parallel::mccollect(wait = FALSE, timeout = 1) :
  1 parallel job did not deliver a result

I do this in the future framework, where you get an error like:

> library(future) 
> plan(multicore)
> f <- future(quit("no"))
> value(f)
Error: Failed to retrieve the result of MulticoreFuture (<none>) from the forked worker (on localhost; PID 17097). Post-mortem diagnostic: No process exists with this PID, i.e. the forked localhost worker is no longer alive.
In addition: Warning message:
In mccollect(jobs = jobs, wait = TRUE) :
  1 parallel job did not deliver a result

HenrikBengtsson avatar Mar 05 '20 16:03 HenrikBengtsson