BiocParallel
BiocParallel copied to clipboard
BiocParallel doesn't propagate warnings
This is not ideal imo, means that warnings silently disappear. Would be fine (ish) if at least a message showed up saying we encountered some warnings
library(BiocParallel)
fun <- function(v) {
warning("A warning")
sqrt(v)
}
bplapply(1:10, fun)
#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] 1.414214
#>
#> [[3]]
#> [1] 1.732051
#>
#> [[4]]
#> [1] 2
#>
#> [[5]]
#> [1] 2.236068
#>
#> [[6]]
#> [1] 2.44949
#>
#> [[7]]
#> [1] 2.645751
#>
#> [[8]]
#> [1] 2.828427
#>
#> [[9]]
#> [1] 3
#>
#> [[10]]
#> [1] 3.162278
Thanks for pointing it out, this is because of log=FALSE in the BPPARAM and the warnings are discarded. A temporary workaround is to enable the log manually by
fun <- function(v) {
warning("A warning")
sqrt(v)
}
bplapply(1:10, fun, BPOPTIONS = bpoptions(log = TRUE))
but I agree that this is not a good design...
I also agree, and am surprised that warnings are not propagated!
Hmm, log=TRUE seems like much more information than I want, and I think the warnings might get lost anyways as a result, if users don't know what they're looking for/at