0

I'm regularly writing a 5 GB NumPy ndarray to disc using H5py. If I close the file during this write, it gets corrupted. Is there any way for me to tell the program something along the lines of, "if somebody ends your program, wait until you finish the file first"? Alternatively, can I revert to the previous file in this case?

Eric Gorlin
  • 319
  • 1
  • 8

1 Answers1

0
try:
    #do stuff
finally:
    #save stuff

Might allow you to capture what has already been processed before app exits?

idjaw
  • 25,487
  • 7
  • 64
  • 83
Logic1
  • 1,806
  • 3
  • 26
  • 43
  • I think I'm already accounting for what you're talking about- I have a progress file, and only update the progress file once I've saved. The problem is that the save process of the main file takes 50 seconds or so, and if I exit during the save process itself the file can't be loaded again. (and will be smaller than 5 GB size) – Eric Gorlin Feb 07 '16 at 02:20
  • when you say: "the file can't be loaded again", are you referring to the progress file? And when you update the progress file, is it an accumulation of processed data or does it just contain one "data dump" from a single application run? – Logic1 Feb 07 '16 at 02:50