-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Support S3 namespaces when retrieving models from buckets #4917
Conversation
…hen S3 namespaces are involved
Thanks for the PR, we'll give it a review as soon as possible. |
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 a lot for opening the PR 👍 The functionality looks good in general.
Please don't forget to add a Changelog entry for your change (you can find instructions on how to do that in the latest README on master)
rasa/nlu/persistor.py
Outdated
@@ -151,11 +151,11 @@ def _persist_tar(self, file_key: Text, tar_path: Text) -> None: | |||
with open(tar_path, "rb") as f: | |||
self.s3.Object(self.bucket_name, file_key).put(Body=f) | |||
|
|||
def _retrieve_tar(self, target_filename: Text) -> None: | |||
def _retrieve_tar(self, model_full_path: Text) -> None: | |||
tar_name = os.path.basename(model_full_path) |
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.
this line should move one down (below the docstring)
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.
Done!
tests/nlu/base/test_persistor.py
Outdated
awsPersistor._retrieve_tar(model) | ||
retrieveArgs = download_fileobj.call_args[0] | ||
assert retrieveArgs[0] == model | ||
assert retrieveArgs[1].name == "model.tar.gz" |
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.
can we move these two tests right below the existing two s3 tests?
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.
Done!
tests/nlu/base/test_persistor.py
Outdated
|
||
# noinspection PyPep8Naming | ||
@mock_s3 | ||
def test_s3_private_retrieve_tar(): |
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.
what exactly is being tested here? A comment would be very helpful
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.
Added! I included this test retroactively to bump coverage back to an acceptable level by coveralls. I'd be happy to also remove it if you think it excessive
Co-Authored-By: ricwo <[email protected]>
@ricwo Many thanks for the review. I've incorporated all your suggestions, and also added a changelog entry 👍 |
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.
Looks great! Thanks for the fixes and again for your contribution ⭐️
@cianclarke looks like you didn't check in the changelog file - would you mind adding that? |
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.
Requesting changes until the changelog file is uploaded - good to merge afterwards
Ah, sorry @ricwo - you're absolutely right. I've committed the changelog entry. |
Co-Authored-By: ricwo <[email protected]>
Co-Authored-By: ricwo <[email protected]>
Co-Authored-By: ricwo <[email protected]>
@ricwo - I committed your args suggestions from the GitHub UI (looks like I may have missed those). |
Thanks @ricwo |
Proposed changes:
.tar.gz
(see Models loaded from S3 buckets do not support namespaces #4916 )Status (please check what you already did):
black
(please check Readme for instructions)Fixes #4916