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

refactor: cache data field #1878

Merged
merged 6 commits into from
Feb 8, 2021
Merged

refactor: cache data field #1878

merged 6 commits into from
Feb 8, 2021

Conversation

florian-hoenicke
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Feb 5, 2021

Codecov Report

Merging #1878 (2f2923f) into master (f0104b4) will increase coverage by 1.96%.
The diff coverage is 97.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1878      +/-   ##
==========================================
+ Coverage   84.32%   86.28%   +1.96%     
==========================================
  Files         147      147              
  Lines        7016     7014       -2     
==========================================
+ Hits         5916     6052     +136     
+ Misses       1100      962     -138     
Impacted Files Coverage Δ
jina/drivers/cache.py 93.75% <75.00%> (ø)
jina/drivers/search.py 96.42% <100.00%> (-0.07%) ⬇️
jina/executors/indexers/cache.py 98.46% <100.00%> (-0.05%) ⬇️
jina/executors/indexers/keyvalue.py 100.00% <100.00%> (ø)
jina/executors/indexers/vector.py 93.75% <100.00%> (+0.03%) ⬆️
jina/drivers/control.py 95.08% <0.00%> (+1.63%) ⬆️
jina/clients/base.py 80.83% <0.00%> (+1.66%) ⬆️
jina/peapods/runtimes/jinad/client.py 82.35% <0.00%> (+2.20%) ⬆️
jina/flow/mixin/crud.py 89.28% <0.00%> (+3.57%) ⬆️
jina/peapods/runtimes/zmq/zed.py 91.42% <0.00%> (+3.57%) ⬆️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0104b4...4946349. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Feb 5, 2021

Latency summary

Current PR yields:

  • 😶 index QPS at 1007, delta to last 3 avg.: +1%
  • 😶 query QPS at 16, delta to last 3 avg.: +0%

Breakdown

Version Index QPS Query QPS
current 1007 16
0.9.30 1001 16
0.9.29 984 15

Backed by latency-tracking. Further commits will update this comment.

@@ -62,15 +62,12 @@ def __init__(self, index_filename: Optional[str] = None, field: Optional[str] =
if self.field not in self.supported_fields:
raise ValueError(f"Field '{self.field}' not in supported list of {self.supported_fields}")

def add(self, doc_id: str, *args, **kwargs):
"""Add a document to the cache depending on `self.field`.
def add(self, doc_id: str, data: str, *args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should break the API of the inherited method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inherited method from the BaseKVIndexer is:
def add(self, keys: Iterable[str], values: Iterable[bytes], *args, **kwargs):

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have the same interface?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed with @lusloher, adapting the interface should be done.

@jina-bot jina-bot added size/M area/testing This issue/PR affects testing and removed size/S labels Feb 7, 2021
Copy link
Contributor

@Yongxuanzhang Yongxuanzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably I could help to update the docstrings when you finished this PR? 😄

def get_query_handler(self):
def get_query_handler(self) -> 'ReadHandler':
"""Get read file handler.
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One-line Docstrings should be in one line. https://docs.jina.ai/chapters/docstring/docstring.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yongxuanzhang nice catch! The pr is merged already, but I will have that in mind next time.

"""
if self.with_serialization:
self.exec_fn(req_doc.id, req_doc.SerializeToString(), **{DATA_FIELD: data})
self.exec_fn([req_doc.id], req_doc.SerializeToString(), [value])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codecov said this line is not covered by tests. Not sure if Codecov is correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. For now, we don't have a cache using this code. But you are right it should be tested in the future.

@hanxiao hanxiao merged commit 2b1e6e6 into master Feb 8, 2021
@hanxiao hanxiao deleted the refactor-cache-data-field branch February 8, 2021 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core This issue/PR affects the core codebase area/testing This issue/PR affects testing component/driver component/executor executor/indexer size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants