toolsforexperiments / labcore

Collection of tools developed and maintained by Pfaff Lab
https://toolsforexperiments.github.io/labcore/
2 stars 13 forks source link

Creating safe_write_mode for DDH5Writter #36

Closed marcosfrenkel closed 3 months ago

marcosfrenkel commented 4 months ago

The DDH5Writter now has a new safe_write_mode that saves each data line in a separate ddh5 file. This makes sure that there are never any lock file issues. It works in the following way:

A new CLI command has also been added 'reconstruct-data' that takjes a path where a .tmp folder is and reconstructs it into a ddh5 file. This is meant as a backup in case something goes wrong with the measurement and the data was not backed up.

wpfff commented 4 months ago

Just from the description: how often does data get stored in the main file? Is that configurable?

And why the complicated folder structure?

marcosfrenkel commented 4 months ago

The main data file gets written every 1000 lines or 60 seconds, whichever comes first. Both of these are class level variables that can be configured.

The complicated folder structure is to not get any penalties for multiple files. I am scared that after a few thousands or so items in a directory (either other directories or files) the file system will slow down. This complicated folder structure is to reduce the chance of getting to that scenario.

wpfff commented 4 months ago

Hm, I'm wondering if the 1000 lines / 60secs doesn't defeat the entire purpose.

We're only getting into problems if we live plot, for example. With that cadence live plotting isn't even useful anymore in most cases.

marcosfrenkel commented 4 months ago

I can cut in half those numbers or even lower, it works fine with any combination of them

wpfff commented 3 months ago

10 secs? (And easily adjustable)

marcosfrenkel commented 3 months ago

Tested in the testbed, works fine all the data is being stored and reconstructed correctly. Merging