| bpok {BiocParallel} | R Documentation |
Identifies unsuccessful results returned from bplapply,
bpmapply, bpvec, bpaggregate or bpvectorize.
bpresume and bplaterror have been deprecated.
bpok(x) ## Deprected: bpresume(expr) bplasterror()
x |
Results returned from a call to |
expr |
A expression to be re-evaluated. If the original error was due to
input error, |
bpok
Returns a logical() vector: FALSE for any jobs that resulted in
an error. x is the result list output by bplapply,
bpmapply, bpvec, bpaggregate or bpvectorize.
bpresume
THIS FUNCTION IS DEPRECATED.
The resume mechanism allows computations with errors to be re-attempted
and is triggered when the argument catch.errors is TRUE.
Unsuccessful results returned from bp*lapply can be identified
with bpok. Failure may have been due to faulty input or hardware
error. Incomplete portions of the job can be reattempted with
bpresume. New results are merged with the previous and returned to
the user.
bplasterror
THIS FUNCTION IS DEPRECATED.
Use attr on the output of bp*apply
to see traceback. See examples.
Michel Lang, Martin Morgan and Valerie Obenchain
## -----------------------------------------------------------------------
## Catch errors:
## -----------------------------------------------------------------------
## By default 'stop.on.error' is TRUE in BiocParallelParam objects.
SnowParam(workers = 2)
## If 'stop.on.error' is TRUE an ill-fated bplapply() simply stops,
## displaying the error message.
param <- SnowParam(workers = 2, stop.on.error = TRUE)
tryCatch({
bplapply(list(1, "two", 3), sqrt, BPPARAM = param)
}, error=identity)
## If 'stop.on.error' is FALSE then the computation continues. Errors
## are signalled but the full evaluation can be retrieved
param <- SnowParam(workers = 2, stop.on.error = FALSE)
X <- list(1, "two", 3)
result <- bptry(bplapply(X, sqrt, BPPARAM = param))
result
## Check for errors:
fail <- !bpok(result)
fail
## Access the traceback with attr():
tail(attr(result[[2]], "traceback"), 5)
## -----------------------------------------------------------------------
## Resume calculations:
## -----------------------------------------------------------------------
## The 'resume' mechanism is triggered by supplying a list of partial
## results as 'BPREDO'. Data elements that failed are rerun and merged
## with previous results.
## A call of sqrt() on the character "2" returns an error.
param <- SnowParam(workers = 2, stop.on.error = FALSE)
X <- list(1, "two", 3)
result <- bptry(bplapply(X, sqrt, BPPARAM = param))
## Fix the input data by changing the character "2" to a numeric 2:
X_mod <- list(1, 2, 3)
## Repeat the original call to bplapply() with the partial results as 'BPREDO':
bplapply(X_mod, sqrt, BPPARAM = param , BPREDO = result)