BiocParallel
BiocParallel copied to clipboard
DoparParam: Captured stdout is relayed to stdout for some foreach adapters and stderr for others
There is an inconsistency in how DoparParam() relays captured standard output. It appears to depend on which %dopar% adapter is registered.
For example,
> foreach::registerDoSEQ()
> out <- utils::capture.output(y <- BiocParallel::bplapply(1:2, print, BPPARAM = BiocParallel::DoparParam()), type = "output")
> out
[1] "[1] 1" "[1] 2"
relays the print() output to stdout, as expected.
But,
> doParallel::registerDoParallel(2)
> out <- utils::capture.output(y <- BiocParallel::bplapply(1:2, print, BPPARAM = BiocParallel::DoparParam()), type = "output")
[1] 1
[1] 2
> out <- utils::capture.output(y <- BiocParallel::bplapply(1:2, print, BPPARAM = BiocParallel::DoparParam()), type = "message")
> out
[1] "[1] 1" "[1] 2"
relays the print() output to stderr, which is not what one would expect from a print() call.