emtpb / dsch

Structured, metadata-enhanced data storage.
Other
2 stars 0 forks source link

Cannot directly close dsch storage files #4

Open JonasHoelscher opened 5 months ago

JonasHoelscher commented 5 months ago

If a dsch storage is created the file will be created and blocked as long as the storage object exists. This is a problem when, for example, creating integration tests: When using dsch to create temporary files in a test environment, the temporary files cannot be removed afterwards.

Quick fix

storage = dsch.create(file, schema)
storage.save()
storage._storage.close()

This closes the file using the internal h5py object. Therefore the user needs to be aware of the open file handlers which he didn't even open.

polymeter commented 5 months ago

Have you tried deleting the storage object (i.e. del storage)? We do not have explicit object teardown, I think, but as long as you don't keep child object references, that should close the file.