Skip to content

bplapply() et al. returns RngFutureError:s rather than signals them #5

@HenrikBengtsson

Description

@HenrikBengtsson
library(BiocParallel.FutureParam)
register(FutureParam())
options(future.rng.onMisuse = "error")
y <- bplapply(1:2, rnorm)
> str(y)
List of 2
 $ :List of 2
  ..$ message: chr "UNRELIABLE VALUE: Future ('<none>') unexpectedly generated random numbers without specifying argument 'seed'. T"| __truncated__
  ..$ call   : NULL
  ..- attr(*, "class")= chr [1:6] "RngFutureError" "FutureError" "error" "RngFutureCondition" ...
  ..- attr(*, "future")=Classes 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' <environment: 0x56148257c1b0> 
 $ :List of 2
  ..$ message: chr "UNRELIABLE VALUE: Future ('<none>') unexpectedly generated random numbers without specifying argument 'seed'. T"| __truncated__
  ..$ call   : NULL
  ..- attr(*, "class")= chr [1:6] "RngFutureError" "FutureError" "error" "RngFutureCondition" ...
  ..- attr(*, "future")=Classes 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' <environment: 0x56148279f320> 

The expected behavior should be:

y <- bplapply(1:2, rnorm)
Error: UNRELIABLE VALUE: Future ('<none>') unexpectedly generated random numbers without specifying argument 'seed'. There is a risk that those random numbers are not statistically sound and the overall results might be invalid. To fix this, specify 'seed=TRUE'. This ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-CMRG method. To disable this check, use 'seed=NULL', or set option 'future.rng.onMisuse' to "ignore".

Similarly, with RngFutureWarning:s, we would expect:

library(BiocParallel.FutureParam)
register(FutureParam())
options(future.rng.onMisuse = "warning")  # default
y <- bplapply(1:2, rnorm)
Warning: UNRELIABLE VALUE: Future ('<none>') unexpectedly generated random numbers without specifying argument 'seed'. There is a risk that those random numbers are not statistically sound and the overall results might be invalid. To fix this, specify 'seed=TRUE'. This ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-CMRG method. To disable this check, use 'seed=NULL', or set option 'future.rng.onMisuse' to "ignore".

but right now those warnings are muffled and never signaled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions