zkwurst / GSoC2017-GRASS-GIS

GNU General Public License v2.0
2 stars 1 forks source link

User stopping script or terminating early #9

Open zkwurst opened 7 years ago

zkwurst commented 7 years ago

Will the script always exit (ie. run the cleanup function) if the user stops the script mid-process in GRASS? Or if the computer gets unplugged or GRASS crashes? When I stopped the script like that, it left incomplete zip files, so it could also potentially leave incomplete .img files, correct? I'm assuming GRASS handles crashes and incomplete files if something like that were to happen during r.import or some other operation, but should we try to implement something similar?

If so, maybe something like a cleanup function that runs at the beginning of the script to make sure there aren't existing usable files in the download directory? Right now I'm trying to handle that in the .zip file check within the main() funct because we need the variable values from the TNM API call before we can check if the files are incomplete or not, what the names are, etc.

This seems to me like one of the last things we need to do to complete r.in.usgsned? Or should we not even worry about it right now and deal with it as we move into r.in.usgs?

petrasovaa commented 7 years ago

The cleanup procedure should remove existing unzipped img files, I think that's still missing. We decided that it is useful to keep always the ZIP files (if they are correctly downloaded), but not the img files, because the unzipping doesn't take much time.

The cleanup is called after it finishes no matter if it finished with or without errors, or interrupted by user.

Regarding r.in.usgs, check first which products are actually available.