BiocParallel icon indicating copy to clipboard operation
BiocParallel copied to clipboard

DoparParam: Captured stdout is relayed to stdout for some foreach adapters and stderr for others

Open HenrikBengtsson opened this issue 7 months ago • 0 comments

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.

HenrikBengtsson avatar May 19 '25 04:05 HenrikBengtsson