ecmwf / skinnywms

Lightweight WMS server for serving maps of netCDF and GRIB data
Apache License 2.0
47 stars 22 forks source link

Clean up temporary files #35

Closed brancomat closed 4 years ago

brancomat commented 4 years ago

Partially addresses #10

This pull request deletes temporary files after they have been served via flask. (it seems there are several ways to achieve this so please check the code to see if it's ok for you)

sylvielamythepaut commented 4 years ago

Hi, Thanks a lot for your contribution , we had a close look at it , and would like to suggest few minors changes.. 1- make the global variable file_remover = FileRemover(), a property of the WmsServer Object itself. 2- in the function _do_cleanup 2.1: replace the print by the equivalent call to LOG.info 2.2: add a try/catch around the remove action

Thanks again Sylvie

brancomat commented 4 years ago

Thanks for the suggestions, I tried to integrate them. I'm not sure about your policy on logger levels, now the "Deleting ..." message is a debug log, while if the remove action fails it throws a LOG.exception

sylvielamythepaut commented 4 years ago

Few more comments from our python expert: Yes, it is perfectly right to use LOG.exception.. But he will recommend to use the following style for all the logging messages. LOG.info("MY text %s... %s", info1, info2) He also recommend to add Exception in the except directive.. Ie except Exception: Thanks again . Sylvie

brancomat commented 4 years ago

I incorporated the recommendations above.