Closed tommykoctur closed 1 year ago
Can you please show why do you think this does not work? Here there is no assertion or check
Hi @JoanFM ,
sure.
python delete_bug_minimal_example.py
⠸ Waiting executor0 summary... ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/3 0:00:002023-02-07 11:08:54.592 | INFO | annlite.index:restore:664 - restore A
nnlite from local
2023-02-07 11:08:54.593 | INFO | annlite.index:_rebuild_index_from_local:771 - Rebuild the indexer from scratch
2023-02-07 11:08:54.596 | INFO | annlite.index:_rebuild_index_from_local:788 - Load the model from /home/username/.cache/jina/AnnLiteIndexer/0/parameters
-2b445f0495bd404037d10b26cf101add
──────────────────────────────────────────────────────────────── 🎉 Flow is ready to serve! ─────────────────────────────────────────────────────────────────
╭────────────── 🔗 Endpoint ───────────────╮
│ ⛓ Protocol GRPC │
│ 🏠 Local 0.0.0.0:63669 │
│ 🔒 Private X.X.X.X:63669 │
│ 🌍 Public X.X.X.X:63669 │
╰──────────────────────────────────────────╯
⠸ Waiting executor0 summary... ━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/3 0:00:002023-02-07 11:08:56.598 | INFO | annlite.index:restore:664 - restore A
nnlite from local
2023-02-07 11:08:56.599 | INFO | annlite.index:_rebuild_index_from_local:771 - Rebuild the indexer from scratch
2023-02-07 11:08:56.601 | INFO | annlite.index:_rebuild_index_from_local:788 - Load the model from /home/username/.cache/jina/AnnLiteIndexer/0/parameters
-2b445f0495bd404037d10b26cf101add
──────────────────────────────────────────────────────────────── 🎉 Flow is ready to serve! ─────────────────────────────────────────────────────────────────
╭────────────── 🔗 Endpoint ───────────────╮
│ ⛓ Protocol GRPC │
│ 🏠 Local 0.0.0.0:64306 │
│ 🔒 Private X.X.X.X:64306 │
│ 🌍 Public X.X.X.X:64306 │
╰──────────────────────────────────────────╯
ERROR executor0/rep-0@3915231 ValueError("'d1' is not in list") [02/07/23 11:08:57]
add "--quiet-error" to suppress the exception details
Traceback (most recent call last):
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/runtimes/worker/__init__.py", line 222,
in process_data
result = await self._request_handler.handle(
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/runtimes/worker/request_handling.py",
line 291, in handle
return_data = await self._executor.__acall__(
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/executors/__init__.py", line 352, in
__acall__
return await self.__acall_endpoint__(req_endpoint, **kwargs)
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/executors/__init__.py", line 408, in
__acall_endpoint__
return await exec_func(
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/executors/__init__.py", line 369, in
exec_func
return await get_or_reuse_loop().run_in_executor(None, functools.partial(func, self,
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/executors/decorators.py", line 182, in
arg_wrapper
return fn(executor_instance, *args, **kwargs)
File "/home/username/jina-multi-sentence-sse/delete_bug_minimal_example.py", line 217, in delete
del self._index[delete_ids]
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/docarray/array/mixins/delitem.py", line 70, in
__delitem__
del self[t]
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/docarray/array/mixins/delitem.py", line 31, in
__delitem__
self._del_doc(index)
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/docarray/array/storage/base/getsetdel.py", line 106,
in _del_doc
self._offset2ids.delete_by_id(_id)
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/docarray/array/storage/base/helper.py", line 31, in
delete_by_id
del self.ids[self.ids.index(_id)]
ValueError: 'd1' is not in list
Traceback (most recent call last):
File "/home/username/jina-multi-sentence-sse/delete_bug_minimal_example.py", line 396, in <module>
delete()
File "/home/username/jina-multi-sentence-sse/delete_bug_minimal_example.py", line 391, in delete
f.post(on='/delete', parameters={'ids': delete_list})
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/clients/mixin.py", line 273, in post
return run_async(
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/helper.py", line 1342, in run_async
return asyncio.run(func(*args, **kwargs))
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/clients/mixin.py", line 264, in _get_results
async for resp in c._get_results(*args, **kwargs):
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/clients/base/grpc.py", line 140, in _get_results
callback_exec(
File "/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/clients/helper.py", line 81, in callback_exec
raise BadServer(response.header)
jina.excepts.BadServer: request_id: "54b0c70b96ad4ea684a5e1d84721bb95"
status {
code: ERROR
description: "ValueError(\"\'d1\' is not in list\")"
exception {
name: "ValueError"
args: "\'d1\' is not in list"
stacks: "Traceback (most recent call last):\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/runtimes/worker/__init__.py\", line 222, in process_data\n result = await self._request_handler.handle(\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/runtimes/worker/request_handling.py\", line 291, in handle\n return_data = await self._executor.__acall__(\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/executors/__init__.py\", line 352, in __acall__\n r
eturn await self.__acall_endpoint__(req_endpoint, **kwargs)\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/executors/__init__.py\", line 408, in __acall_endpoint__\n return await exec_func(\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/executors/__init__.py\", line 369, in exec_func\n return await get_or_reuse_loop().run_in_executor(None, functools.partial(func, self,\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/concurrent/futures/thread.py\", line 58, in run\n result = self.fn(*self.args, **self.kwargs)\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/jina/serve/executors/decorators.py\", line 182, in arg_wrapper\n return fn(executor_instance, *args, **kwargs)\n"
stacks: " File \"/home/username/jina-multi-sentence-sse/delete_bug_minimal_example.py\", line 217, in delete\n del self._index[delete_ids]\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/docarray/array/mixins/delitem.py\", line 70, in __delitem__\n del self[t]\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/docarray/array/mixins/delitem.py\", line 31, in __delitem__\n self._del_doc(index)\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/docarray/array/storage/base/getsetdel.py\", line 106, in _del_doc\n self._offset2ids.delete_by_id(_id)\n"
stacks: " File \"/home/username/miniconda3/envs/jina-test/lib/python3.10/site-packages/docarray/array/storage/base/helper.py\", line 31, in delete_by_id\n del self.ids[self.ids.index(_id)]\n"
stacks: "ValueError: \'d1\' is not in list\n"
executor: "AnnLiteIndexer"
}
}
exec_endpoint: "/delete"
target_executor: ""
Thanks for reporting, we will look into it.
Hey @tommykoctur , I believe the issue is that the index
was not yet rebuilt. I think you can skip the Error and resend the delete post request later
Thanks @JoanFM for suggestion. I tried code below. I hope that can simulate rebuilding the index. But the same error at the end.
from jina import Flow
import numpy as np
da = DocumentArray([
Document(id="d1", embedding=np.array([1, 2, 3, 4, 5])),
Document(id="d2", embedding=np.array([2, 3, 4, 5, 6])),
Document(id="d3", embedding=np.array([3, 4, 5, 6, 7])),
])
def index():
f = Flow().add(uses=AnnLiteIndexer)
with f:
f.post(on='/clear')
f.post(on='/index', inputs=da)
f.post(on='/dump')
def search():
f = Flow().add(uses=AnnLiteIndexer)
with f:
f.post(on='/search', inputs=DocumentArray(da[0]))
def delete():
f = Flow().add(uses=AnnLiteIndexer)
delete_list = ["d1"]
with f:
f.post(on='/delete', parameters={'ids': delete_list})
if __name__ == "__main__":
index()
search()
delete()
@jemmyshin @JoanFM I forgot to add one more hint. offsets2ids sqlite table is empty, shouldn't it has some entries ? or is it obsolete for annlite ?
We found the problem. There is a bug on our side, but offset2ID
is not important to ANNLite, it should work if you pass list_like=False
in the config of the DocumentArrayAnnLite.
Also, please use /backup
instead of /dump
for AnnliteIndexer @tommykoctur
@jemmyshin @JoanFM thank you for suggestions. I want to let you know that I asked my colleague to test it (i didn't had much time) and he said that this workaround with list_like=False and using /backup didn't solved that issue.
We released a new version of ANNLite, you should be able to use the new version
Hi @JoanFM, @jemmyshin ,
we can confirm that annlite=0.5.6 and 0.5.7 is working, but there is needed to put list_like=False to annlite config. Thanks for your support.
BTW, why is taking so long to get new version (0.5.7) from your git to pipy ... can this process be speed up somehow ?
Hello,
I have found that delete in executor.py does not work ( or I am doing something wrong). This is minimal reproducible example:
Thank you very much in advance!