Karl Forner
2013-Apr-11 11:43 UTC
[Rd] parallel::mclapply does not return try-error objects with mc.preschedule=TRUE
Hello, Consider this: 1) library(parallel) res <- mclapply(1:2, stop) #Warning message: #In mclapply(1:2, stop) : # all scheduled cores encountered errors in user code is(res[[1]], 'try-error') #[1] FALSE 2) library(parallel) res <- mclapply(1:2, stop, mc.preschedule=FALSE) #Warning message: #In mclapply(1:2, stop, mc.preschedule = FALSE) : # 2 function calls resulted in an error is(res[[1]], 'try-error') #[1] TRUE The documentation states that: 'Each forked process runs its job inside try(..., silent = TRUE) so if errors occur they will be stored as class "try-error" objects in the return value and a warning will be given.' Is this a bug ? Thanks Karl> sessionInfo()R version 2.15.3 (2013-03-01) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] parallel stats graphics grDevices utils datasets methods [8] base loaded via a namespace (and not attached): [1] tools_2.15.3
Prof Brian Ripley
2013-Apr-23 13:12 UTC
[Rd] parallel::mclapply does not return try-error objects with mc.preschedule=TRUE
On 11/04/2013 12:43, Karl Forner wrote:> Hello, > > Consider this: > > 1) > library(parallel) > res <- mclapply(1:2, stop) > #Warning message: > #In mclapply(1:2, stop) : > # all scheduled cores encountered errors in user code > > is(res[[1]], 'try-error') > #[1] FALSE > > > 2) > library(parallel) > res <- mclapply(1:2, stop, mc.preschedule=FALSE) > #Warning message: > #In mclapply(1:2, stop, mc.preschedule = FALSE) : > # 2 function calls resulted in an error > > is(res[[1]], 'try-error') > #[1] TRUE > > The documentation states that: > 'Each forked process runs its job inside try(..., silent = TRUE) so if > errors occur they will be stored as class "try-error" objects in the > return value and a warning will be given.' > > > Is this a bug ?Not in parallel. Something else has changed, and I am about to commit a different version that still works as documented.> > Thanks > Karl > > >> sessionInfo() > R version 2.15.3 (2013-03-01) > Platform: x86_64-unknown-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=C LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] parallel stats graphics grDevices utils datasets methods > [8] base > > loaded via a namespace (and not attached): > [1] tools_2.15.3 > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595