Scan-o-Matic / scanomatic

Scanomatic
GNU General Public License v3.0
10 stars 4 forks source link

Put calibrations in the database #322

Closed gdetrez closed 6 years ago

gdetrez commented 6 years ago

Sorry, this is very long but I couldn't really do better without introducing unused code. I tried to bundle related changes in different commit which might make it easier to digest.

The main change here is re-implementing CalibrationStore using the database, that is:

I also added the default calibration as part of the migration.

Then, in 92d58cc I remove the "old" CalibrationStore from scanomatic.data_processing.calibration and the corresponding unit tests.

In f543918, I refactor the calibration API to use the new store. That involved moving much of the corresponding tests to the integration suite.

Finally, integrate the new store with the different jobs that use calibrations (mostly to validate the passed ID...) This was the most awkward part as I didn't find an easy way to pass the calibration store through all the factories and models to where it is needed without refactoring way too many things. So I ended-up creating a context manager that creates a store from the environment variables directly. This is not ideal but not worst that the previous situation. And it makes it work without refactoring the whole rpc server.

Tests

I successfully went through the calibration process. I successfully ran comile/analysis/feature extraction.

gdetrez commented 6 years ago

Need to fix one more test...