-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
Add support for internal copy in S3 blob db #13203
Conversation
@@ -8,7 +9,7 @@ | |||
from corehq.blobs.util import ClosingContextProxy | |||
|
|||
import boto3 | |||
from boto3.s3.transfer import S3Transfer, ReadFileChunk | |||
from boto3.s3.transfer import S3Transfer |
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.
F401 'S3Transfer' imported but unused
Internal copy performs an efficient copy operation when `put`ting a blob that was previously loaded using `get`. A new version of boto3 (v1.4.0) is needed for the copy operation. The upgrade also simplified multipart upload support.
dd85087
to
f2a1b5d
Compare
return self | ||
|
||
def __exit__(self, *args, **kwargs): | ||
self.close() |
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.
💀
Nice |
osutil = OpenFileOSUtils() | ||
transfer = S3Transfer(self.db.meta.client, osutil=osutil) | ||
transfer.upload_file(content, self.s3_bucket_name, path) | ||
self._s3_bucket().upload_fileobj(content, 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.
Notable difference in new upload_fileobj
implementation in boto3 (v1.4.0): boto/s3transfer#52
Internal copy performs an efficient copy operation when
put
ting a blob that was previously loaded usingget
.A new version of boto3 (v1.4.0) is needed for the copy operation. The upgrade also simplified multipart upload support.
@snopoke cc @NoahCarnahan