DigitalGlobe / gbdxtools

(Deprecated) Python SDK for using GBDX
MIT License
74 stars 57 forks source link

CatalogImage.is_ordered() doesn't make sense #761

Closed drwelby closed 4 years ago

drwelby commented 5 years ago

CatalogImage.is_ordered('<id>') returns whether the image has been ingested into RDA or not.

is_ordered('<id>') should indicate whether the image was ordered.

is_ingested('<id>') or in_RDA('<id>') or just available('<id>') should do what this method currently does.

a simple .status('<id>') that returns {'ordered': True, 'available': False} would be clear and simple too.

Brett55 commented 5 years ago

@drwelby I did some work on this, not sure if you are referring to what's in dev branch

drwelby commented 5 years ago

No, was just passing on user feedback. If you have potential solutions in dev that's great.

mgregor-oa commented 4 years ago

I think we need to rethink this fix. The issue as I see it is related to the use of terminology around GBDX and RDA. GBDX orders images to be used in workflows and RDA either has the data available or not. While you may order an image in GBDX to get it ingested into RDA for use, saying is_ordered() is referring to the GBDX process and not the RDA process of being available. Also, adding a method to this class to check if the GBDX process has been completed (ie is_available_in_gbdx('<id>')) may confuse the issue further by using an RDA class to check on a GBDX process. Therefore I think the checks should be completely segregated. GBDX has a series of different checks to see if an image is ordered and/or delivered to the GBDX platform for use in the workflow system (catalog.get_data_location() odering.order('<id>')). The CatalogImage class (aka the RDA process) needs a check that accurately reflects the availability for its process. The is_ordered('<id>') method does that, but the name is the confusing part. I suggest changing the name of that method to is_available('<id>'). Once the methods are segregated, you can update the docs with that info, stating that _while you can order the image in GBDX for use in RDA, it is not available in RDA until the Catalog.isavailable('') says it is . That should hopefully limit end user confusion between the methods.

drwelby commented 4 years ago

Questions about ordering status will be handled solely by the Ordering module, adding:

Without the original order ID there is no way to see if an image has been ordered but is pending delivery except to re-order it.

From the CatalogImage standpoint only one thing matters: is the image ingested in RDA and available for use? This can be handled with

A typical workflow would then be:

if not Ordering.is_delivered(cat_id):
   Ordering.order(cat_id)
while not CatalogImage.is_available(cat_id):
    time.sleep(60)
img = CatalogImage(cat_id)

If an image has been ordered but has not been delivered or ingested, the only solution is to wait for the process to complete.

CatalogImage objects should also throw similar exceptions when they are created but the image is not delivered and ingested:

This would make CatalogImage errors more understandable, and also actionable like:

if not Ordering.is_delivered(cat_id):
   Ordering.order(cat_id)
while not img:
    try:
        img = CatalogImage(cat_id)
    except ImageNotAvailable:
        time.sleep(60)
drwelby commented 4 years ago

addressed in 059a5