spacepy / dbprocessing

Automated processing controller for heliophysics data
5 stars 4 forks source link

getFiles with newest_version, exists, and latest version doesn't exist #89

Open jtniehof opened 3 years ago

jtniehof commented 3 years ago

if getFiles is called with exists and newest_version both set True, what will be returned is the newest version which exists on disc. If, for some reason, there's an older version (call it 1.2.0) which still exists on disc, and a newer version (say 1.3.0) which does not, this will return version 1.2.0. I would expect it to return nothing: there is no file which is both the newest version and exists.

Obviously this is a pathological case and pretty low in importance, but I wanted to capture it.

Relation to an issue

This was noted in #47 which is closed in #90 without affecting this behavior, so wanted to make sure this was captured.

Again, I think a complete fix to #45 would probably also incorporate this, but I don't want to grab that nettle just yet, so again...making sure it's captured.

Proposed enhancement

Return nothing if there are no files that match conditions which are both newest version and exist on disc.

Alternatives

Best alternative is to fix #45.

We could also proclaim that the newest version must always exist, or at very least that if one exists, it's the latest, and anything else is a database inconsistency.

OS, Python version, and dependency version information:

Linux-4.15.0-156-generic-x86_64-with-Ubuntu-18.04-bionic
sys.version_info(major=2, minor=7, micro=17, releaselevel='final', serial=0)
sqlalchemy=1.1.11

Version of dbprocessing

Current master (5c0082c9c64e0b7c0b244ee168f4e571a19109dd)

Closure condition

This issue should be closed when a PR is merged that has a test where the newest version doesn't exist on disc, an earlier version does, and getFiles returns nothing. And this test passes.