h5TryOpen {hdf5r.Extra} | R Documentation |
Automatically retry opening HDF5 file
Description
Helper function to open an HDF5 file. When the opening fails, will retry it until reach a timeout.
Usage
h5TryOpen(
filename,
mode = c("a", "r", "r+", "w", "w-", "x"),
timeout = getOption(x = "h5TryOpen.timeout", default = 0),
interval = getOption(x = "h5TryOpen.interval", default = 0),
...
)
Arguments
filename |
An HDF5 file to open |
mode |
How to open it:
|
timeout |
Positive integer. The timeout for retrying. |
interval |
Positive integer. The interval seconds of retrying. |
... |
Arguments passed to |
Details
timeout
and interval
must be positive. Otherwise no retrying,
which is default setting.
Value
When file
is opened successfully, an H5File
will
be returned. Otherwise, will keep retrying. When a timeout is reached, will
raise an error and terminate the current R session.
See Also
H5File
for mode
Examples
file <- system.file("extdata", "pbmc_small.h5ad", package = "hdf5r.Extra")
h5fh <- h5TryOpen(file, mode = "r")
h5fh
h5fh$close_all()