-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated order delivery config for zipped orders #989
Conversation
Great work, @JSee98!
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: #989 (comment) |
.gitignore
Outdated
@@ -24,6 +24,6 @@ coverage.xml | |||
|
|||
# Editors | |||
.vscode/ | |||
|
|||
.idea/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this is, but it isn't needed for our project. Could you please remove it from the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this was just for Pycharm IDE. So if you use vscode as IDE the settings for the same are added under .vscode. Similarly, for IntelliJ products (Pycharm here), we get .idea to store the IDE settings. This shouldn't be a breaking change, however, I'll still remove it for the timebeing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, @JSee98!
- I just had 1 small change request for your test.
- There is a typing issue
mypy
is running into. See if you can resolve that locally, if not I'm happy to help. - There appears to be a small merge conflict since I changed the base branch. Would you also be able to resolve that, please?
I'm going to test this out by delivering to a cloud bucket with this logic tomorrow. I recall having success delivering zipped files using single_archive=True
and archive_filename=name.zip
, but I'm hoping I was right in the ticket description I was correct that you could use either of those keywords. I'll report back tomorrow!
4b21e3a
to
a5dfa0e
Compare
Also, |
Created an order where 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: Similarly, I created an order assigning 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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JSee98 thanks for the contribution! Can you and @kevinlacaille consider my suggestion?
planet/order_request.py
Outdated
@@ -199,6 +199,10 @@ def delivery(archive_type: Optional[str] = None, | |||
if archive_type: | |||
archive_type = specs.validate_archive_type(archive_type) | |||
|
|||
# for missing archive options set single_archive to false | |||
if archive_filename is None and single_archive is False: | |||
single_archive = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JSee98 @kevinlacaille I have a different perspective on the problem. I don't think we want to change the single/multi flag, and thus the shape of the delivered artifacts, based on other inputs. Instead I think we want to make sure that the archive_filename defaults to some value if it is not specified. After a close read of https://developers.planet.com/apis/orders/delivery/#zipping-results, I believe we want something like this:
if archive_type:
archive_filename = archive_filename or "{{name}}_{{order_id}}.zip"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just to confirm @sgillies, your suggestion is if both the variables are undefined i.e. archive_filename and single_archive we should give a default value to archive_filename?
If you and @kevinlacaille agree on this suggested path I can make the required changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JSee98 we should provide a default for archive_filename
whenever archive_type evaluates to True, no matter the value of single_archive
. @kevinlacaille (traveling at the moment, so I'm speaking for him 😆) asked the API team and found that the need to specify an archive filename is a known Orders API bug and that this Python project is the right place to work around it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure guys, will make the updates and raise the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sgillies I've made the updates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @JSee98 !
Related Issue(s):
Closes #963
Proposed Changes:
For inclusion in changelog (if applicable):
archive_filename
andsingle_archive
are undefined.Not intended for changelog:
Diff of User Interface
Old behavior:
In
order_request.delivery()
, ifarchive_type
was set tozip
, butarchive_filename
andsingle_archive
were both undefined, data was not delivered zipped.New behavior:
Now, in
order_request.delivery()
, ifarchive_type
is set tozip
, butarchive_filename
andsingle_archive
are both undefined, data will deliver as zipped.PR Checklist:
(Optional) @mentions for Notifications: