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:

  • a creates a new file or opens an existing one for read/write.

  • r opens an existing file for reading

  • r+ opens an existing file for read/write.

  • w creates a file, truncating any existing ones.

  • w- and x are synonyms, creating a file and failing if it already exists.

timeout

Positive integer. The timeout for retrying.

interval

Positive integer. The interval seconds of retrying.

...

Arguments passed to H5File$new()

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()


[Package hdf5r.Extra version 0.0.6 Index]