Skip to content
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

allow >5GB and turn on multi-part uploads for AWS #829

Merged
merged 3 commits into from
Aug 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/maggma/stores/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from concurrent.futures import wait
from concurrent.futures.thread import ThreadPoolExecutor
from hashlib import sha1
from io import BytesIO
from typing import Dict, Iterator, List, Optional, Tuple, Union
from json import dumps
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union

Expand Down Expand Up @@ -383,10 +385,12 @@ def write_doc_to_s3(self, doc: Dict, search_keys: List[str]):
s3_to_mongo_keys["s3-to-mongo-keys"] = "s3-to-mongo-keys" # inception
# encode dictionary since values have to be strings
search_doc["s3-to-mongo-keys"] = dumps(s3_to_mongo_keys)
s3_bucket.put_object(
s3_bucket.upload_fileobj(
Fileobj=BytesIO(data),
Key=self.sub_dir + str(doc[self.key]),
Body=data,
Metadata={s3_to_mongo_keys[k]: str(v) for k, v in search_doc.items()},
ExtraArgs={
"Metadata": {s3_to_mongo_keys[k]: str(v) for k, v in search_doc.items()}
},
)

if lu_info is not None:
Expand Down