-
Notifications
You must be signed in to change notification settings - Fork 8
Extend upload endpoint to accept both types - clks and clknblocks #503
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
Conversation
hardbyte
left a comment
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.
A few suggested changes to consider then good to merge.
| # check if the following combinations are true | ||
| # - uses_blocking is False AND 'clks' element in upload JSON | ||
| # - uses_blocking if True AND 'clknblocks' element in upload JSON | ||
| # otherwise, return safe_fail_request |
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.
Nitpick: This might as well be a docstring. (code comments like this don't come up IDE tooltips)
| # json into memory. -> issue #184 | ||
|
|
||
| receipt_token, raw_file = upload_json_clk_data(dp_id, get_json(), span) | ||
| receipt_token, raw_file = upload_json_clk_data(dp_id, get_json(), span, uses_blocking) |
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.
Another nitpick. Utility arguments such as span should come after the useful ones.
| Convert user provided encodings from json array of base64 data into | ||
| a newline separated file of base64 data. |
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 think this docstring is now out of date?
| logger.info('Writing uploaded {} JSON to {}'.format(element.upper(), tmp.name)) | ||
| json.dump(clk_json, tmp) | ||
|
|
||
| logger.info(f"Received {count} encodings. Uploading {fmt_bytes(num_bytes)} to object store") |
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 now looks like a debug log statement - the tmp.name won't actually be around after the tmp file goes out of scope.
Could be worth logging the object store filename at info level in here though.
|
Closing after rebasing into |
By introducting blocking in
anonlink-client, we also want to updateentity-serviceto support blocking.In this pull request, we extended the upload endpoint i.e.
upload_json_clk_datato accept both uploading types:clkselementclknblockselementwith a focus on error handling.
Note that we also changed the way that writes to MINIO from
put_objecttofput_objectto avoid large in memory bytes conversion.Currently it will fail CI since it is only the start of this update to support blocking and more modifications are required to make the whole entity service work with blocking.
Close #501