Closed cmkaul closed 8 years ago
The "delete_old" and "times_retained" features have been added, tested, and pushed to the master branch. Please exercise some caution when the "delete_old" option is used as directories (and any contents) will be deleted without asking the user to confirm. In particular, make sure that all paths are specified correctly in your namelist file to avoid any inadvertent deletions (although this should only be possible if the directory name ends in '_old', '_recent', or '_new')
Motivated by the addition of the CGILS cases, which run for extended periods, I am adding a new option for restart files: the "delete_old" option.
If namelist['restart']['delete_old'] = True, only the 2 most recently generated restart directories will be retained. In the case of runs that are restarted, the input restart directory is also retained.
If the run completes normally, the restart directories will have the normal naming structure (simply the output time). If the run crashes, then the restart directories will have suffixes: time0+'_original' [the input restart file, if any] , time1+'recent' [the penultimate restart directory, time2+'new' [the final restart directory produced]. This is a trifle untidy, but it doesn't seem worthwhile at this point to determine how to add the error handling necessary to ensure that these suffixes are trimmed off in the event of an early exit--a user can easily write a script to take care of that contingency.
I'll also look into adding a feature that allows certain restart times specified via the namelist to be retained (not deleted when they become "old").