mockslurm.process_db.open_file_retry_on_locked

mockslurm.process_db.open_file_retry_on_locked(file: Path, mode: str = 'a', nb_retries: int = 40, wait_s: float = 0.01) File[source]

Open file as an HDF5 file in mode.

Since the HDF5 files are locked when another process access them, this function tries to open the file a certain number of time.

Parameters:
  • file (Path) – Path to the file to open

  • nb_retries (int, optional) – Number of times to try to open the file, by default 40

  • wait_s (float, optional) – Amount of time to wait between 2 attempts to open the file, in seconds, by default 0.1

Returns:

Open file handle to file.

Return type:

h5py.File