Skip to content
Prev 7901 / 21312 Next

[Bioc-devel] using covr with the parallel package

Leonard,

Setting `mc.preschedule = TRUE` and `ncores < 2` results in `mclapply`
(which `mcmlapply` calls) delegating to a simple `lapply` (see
https://github.com/wch/r-source/blob/7578138223130d3c6197b95c3cbbe1e78a5cf230/src/library/parallel/R/unix/mclapply.R#L117).
Since this `lapply` runs in the current process coverage works fine.

`mc.preschedule = FALSE` calls `mcparallel` in all cases, which spawns
child processes, and coverage is not tracked in child processes.

I don't have any plans to support tracking coverage in child processes at
the moment (although I suppose it is possible in the future).

So the answer seems to be if you want test coverage to work with parallel
code you need to run it with `ncores = 1` and `mc.preschedule = TRUE`.

I will add something to that effect in the covr README.

Thank you for reporting the issue!

Jim

(posting includes off-list email exchange when I neglected to include
bioc-devel in the response)

On Mon, Aug 17, 2015 at 2:34 PM, Leonard Goldstein <
goldstein.leonard at gene.com> wrote: