-
Notifications
You must be signed in to change notification settings - Fork 31
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
Encode _
as --
in metadata when using S3Store.write_doc_to_s3
#532
Conversation
Codecov Report
@@ Coverage Diff @@
## main #532 +/- ##
==========================================
+ Coverage 88.99% 89.02% +0.02%
==========================================
Files 40 40
Lines 2736 2743 +7
==========================================
+ Hits 2435 2442 +7
Misses 301 301
Continue to review full report at Codecov.
|
src/maggma/stores/aws.py
Outdated
s3_bucket.put_object( | ||
Key=self.sub_dir + str(doc[self.key]), | ||
Body=data, | ||
Metadata={k: str(v) for k, v in search_doc.items()}, | ||
Metadata={k.replace('_', '--'): str(v) for k, v in search_doc.items()}, |
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.
Should we do a single -
instead?
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.
Will defer to your judgement here. I suggested the double --
with the logic that it would be easier to do the reverse operation, assuming that people don't use --
that often, but perhaps this best avoided since it is not guaranteed.
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.
Hmm - I don't feel strongly about it, but I think --
symbols are a bit confusing. It should be ok with just simplifying to a _
-> -
conversion for readability.
And also call from `rebuild_metadata_from_index`
This pull request introduces 1 alert when merging 0189c53 into 93ee676 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging c5ca583 into 93ee676 - view on LGTM.com new alerts:
|
One issue I ran into that might be appropriate to add to this PR is that there seems to be a missing requirement in maggma (or maybe atomate?) for boto3 in order to use a S3store. Here is the error I got. RuntimeError Traceback (most recent call last) /global/u1/a/acrutt/git_mp/atomate/atomate/vasp/database.py in insert_task(self, task_doc, use_gridfs) /global/u1/a/acrutt/git_mp/atomate/atomate/vasp/database.py in insert_object(self, use_gridfs, *args, **kwargs) /global/u1/a/acrutt/git_mp/atomate/atomate/vasp/database.py in insert_maggma_store(self, d, collection, oid, task_id) /global/u1/a/acrutt/git_mp/atomate/atomate/utils/database.py in get_store(self, store_name) /global/u1/a/acrutt/git_mp/atomate/atomate/utils/database.py in get_s3_store(self, store_name) /global/u1/a/acrutt/git_mp/maggma/src/maggma/stores/aws.py in init(self, index, bucket, s3_profile, compress, endpoint_url, sub_dir, s3_workers, key, store_hash, searchable_fields, **kwargs) RuntimeError: boto3 and botocore are required for S3Store |
I guess the related question is, has boto3 ever been a difficult dependency to install, or is it fairly reliable and lightweight? If the latter I would err towards including. |
I haven't ever had any issues with it, so I am not sure. Do you have any opinion on this @shyamd? |
None, we did it early on to make sure we didn't overcommit dependencies, but now that its pretty normal to use it makes sense to shift to a required dependency. |
To resolve a reported bug from @acrutt and @rkingsbury with:
Fix proposed by @shreddd.