planetlabs / planet-client-python

Python client for Planet APIs
https://planet-sdk-for-python-v2.readthedocs.io/en/latest/
Apache License 2.0
271 stars 91 forks source link

Updated order delivery config for zipped orders #989

Closed JSee98 closed 1 year ago

JSee98 commented 1 year ago

Related Issue(s):

Closes #963

Proposed Changes:

For inclusion in changelog (if applicable):

  1. Orders now deliver zipped to cloud storage, even when archive_filename and single_archive are undefined.

Not intended for changelog:

Diff of User Interface

Old behavior: In order_request.delivery(), if archive_type was set to zip, but archive_filename and single_archive were both undefined, data was not delivered zipped.

New behavior: Now, in order_request.delivery(), if archive_type is set to zip, but archive_filename and single_archive are both undefined, data will deliver as zipped.

PR Checklist:

(Optional) @mentions for Notifications:

kevinlacaille commented 1 year ago

Great work, @JSee98!

  1. I changed the PR to merge to main. Could you please resolve the minor merge conflicts we're running into? If you need a had I'd happy to help you with that.
  2. It looks like mypy's type checking is failing. See if you can resolve this on your end. Try running mypy --ignore-missing planet in your terminal this branch. Typing can be a bit tricky to resolve, so please feel free to reach out if you need help with this.
  3. Below is a summary of what I'm seeing:

Previously:

planet.order_request.delivery("zip") 
#returns {'archive_type': 'zip'}

planet.order_request.delivery("zip", archive_filename="test.zip")
#returns {'archive_type': 'zip', 'archive_filename': 'test.zip'}

Now:

planet.order_request.delivery("zip") 
#returns {'archive_type': 'zip', 'single_archive': True}

planet.order_request.delivery("zip", archive_filename="test.zip")
#returns {'archive_type': 'zip', 'archive_filename': 'test.zip'}

This satisfies the desired logic where the delivery object should contain either:

    "archive_type": "zip",
    "single_archive": true

or

    "archive_type": "zip",
    "archive_filename": "{{name}}.zip"

Now, I just need to verify that an order actually delivers to a bucket (e.g., GCP bucket) using both of those methods.

Update: The data delivers as expected. See this comment for more detail: https://github.com/planetlabs/planet-client-python/pull/989#issuecomment-1634846035

JSee98 commented 1 year ago

Also, nox isn't failing locally anymore, consequently mypy --ignore-missing planet command is also running fine locally. This must be due to the rebase with the main branch.

kevinlacaille commented 1 year ago

Created an order where single_archive=True and archive_filename was unassigned: https://orders-ui.prod.planet-labs.com/orders/5ab30bb4-613b-4315-b44e-6a1bb60b556d

The delivery config contained:

{
    "google_cloud_storage": {
        "bucket": "devrel-notebooks",
        "credentials": "<REDACTED>"
    },
    "archive_type": "zip",
    "single_archive": true
}

Result: Order delivered as a "Single Zip", containing: manifest.json and output.zip, as one would expect.

Similarly, I created an order assigning archive_filename="test_filename.zip" and single_archive was unassigned: https://orders-ui.prod.planet-labs.com/orders/9a99249a-3db8-470b-8756-e5423a563d30

The delivery config contained:

{
    "google_cloud_storage": {
        "bucket": "devrel-notebooks",
        "credentials": "<REDACTED>"
    },
    "archive_type": "zip",
    "archive_filename": "test_filename.zip"
}

Result: Order delivered as a "Per Bundle Zip", containing: manifest.json and test_filename.zip, as one would expect.