sot / timelines

Commanded states timelines
3 stars 0 forks source link

Fix the issue with year rollover in get_replan_dir (again) #21

Closed jeanconn closed 5 years ago

jeanconn commented 5 years ago

Fix the issue with year rollover in get_replan_dir (again)

In #20 we patched get_replan_dir to allow it to line up the name of a summary file with a file in a "previous" year directory if that file had been created within 21 days of "now". "now" was the wrong thing to use, however, as we may occasionally want to reprocess previous data, and it looks like in normal operations we reprocess to check that nothing has changed over an interval of more than 21 days.

So, this commit updates the API of get_replan_dir to instead take the date of the new load to use as a reference time (instead of "now") for the "look back up to 30 days" for a file/directory that was replanned o make this new load.

Additionally, using the modification date of the file for which we seek is also the wrong thing, as the modification date of the file is not really an intrinsic property we care about (it is useful for keeping the database up-to-date). Instead, this code now uses the date of the start of the load products (which is a quantity that is already parsed in the database we have of these processing summary files).

jeanconn commented 5 years ago

Apologies we're back with this. Nothing incorrect has been ingested in the database and it is up-to-date, I just didn't fix that previous bug in a robust fashion. I think this new fix makes sense for this tiny special case, but also still need to fix the timelines tests (I have not tried to rebuild the full database using this fix).