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
fix: add delete() for cached property #2144
Conversation
37c0de8
to
147b3f6
Compare
Codecov Report
@@ Coverage Diff @@
## master #2144 +/- ##
==========================================
- Coverage 90.38% 90.37% -0.02%
==========================================
Files 211 211
Lines 11199 11205 +6
==========================================
+ Hits 10122 10126 +4
- Misses 1077 1079 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Latency summaryCurrent PR yields:
Breakdown
Backed by latency-tracking. Further commits will update this comment. |
@JoanFM (not sure why I can't quote your comments)
Yes, that is a smell buried deep in Jina unfortunately. We are caching the query handler, for example in here jina/jina/executors/indexers/__init__.py Line 85 in 640daf4
I see why this is necessary as we want to avoid the performance hit of having to build it up every time.
Hm I see. Is there any alternative you can think of? We could check that the field name is something like 'query handler' etc., but that would be just as bad. We are making a similar assumption here: jina/jina/executors/indexers/__init__.py Line 169 in 640daf4
|
Can't we maybe have a private class that can control if a handler is to be reread or recomputed or something? |
Not sure I understand what you mean. Another class decorator, like |
What we could do is to have an argument for the decorator, which says, if it is closable of not in order to make it explicit instead of implicit. Anyhow, the current solution is fine in my opinion. |
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.
LGTM
del
for@cached_property
NOTE
@florian-hoenicke @JoanFM @maximilianwerk
Closing the query_handler is now coherent, but makes the update and delete ops slower. This is a trade-off we need to discuss perhaps.
Before, we were only closing the qhandler's body but still relying on its header to get the keys. That was a bit of smell due to the design of the Write/ReadHandlers in BinaryPb. Once we call close we shouldn't be able to access it, but we are.
Do we want to keep the old way (less readable, but more efficient), or this way (more readable, less efficient)?