python - Corrupt files when creating HDF5 files without closing them (h5py) -
i using h5py store experiment data in hdf5 container.
in interactive session open file using:
measurement_data = h5py.file('example.hdf5', 'a') then write data file using self-written functions (can many gb of data couple of days experiment). @ end of experiment close file using
measurement_data.close() unfortunately, time time happens, interactive session ends without me explicitly closing file (accidentally killing session, power outage, crash of os due other software). results in corrupt file , loss of complete data. when try open it, error:
oserror: unable open file (file signature not found) i cannot open file in hdfview, or other software tried.
- is there way avoid corrupt file if not closed explicitly? i've read using statement here, i'm not sure if help, when session unexpectedly ends.
- can restore data in corrupt files in way? there repair program available?
always opening , closing file every write access sounds pretty unfavorable me, because continuously writing data many different functions , threads. i'd more happy different solution.
the corruption problem known hdf5 designers. working on fixing in version 1.10 adding journalling. in mean time can call flush() periodically make sure writes have been flushed, should minimise of damage. can try use external links allow store pieces of data in separate files link them 1 structure when read them.
Comments
Post a Comment