Skip to content

fix(annlite): bump annlite to v0.4.0#622

Closed
jemmyshin wants to merge 28 commits intomainfrom
fix-annlite
Closed

fix(annlite): bump annlite to v0.4.0#622
jemmyshin wants to merge 28 commits intomainfrom
fix-annlite

Conversation

@jemmyshin
Copy link
Copy Markdown
Contributor

@jemmyshin jemmyshin commented Oct 14, 2022

Goals:
Recently we are going to release Annlite v0.4.0. We replace lmdb with rocksdb to reduce memory footprint.
More details are here, green lines in these charts (rocksdb and meta table on disk) are our implementation now.
This pr fixes the errors in Annlite-related unit tests introduced by file lock in rocksdb.
We will make a formal pr once we confirm that Annlite won't break the docarray test.

  • Manually close Annlite in unit test in order to solve the file lock issue.
  • check and update documentation, if required. See guide

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 14, 2022

Codecov Report

Merging #622 (49c7ea6) into main (26e039b) will increase coverage by 0.15%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #622      +/-   ##
==========================================
+ Coverage   86.48%   86.64%   +0.15%     
==========================================
  Files         133      133              
  Lines        6771     6528     -243     
==========================================
- Hits         5856     5656     -200     
+ Misses        915      872      -43     
Flag Coverage Δ
docarray 86.64% <ø> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
docarray/array/base.py 72.72% <ø> (+3.49%) ⬆️
docarray/array/chunk.py 91.30% <ø> (+3.30%) ⬆️
docarray/array/document.py 86.53% <ø> (+15.76%) ⬆️
docarray/array/match.py 90.47% <ø> (+3.51%) ⬆️
docarray/array/mixins/content.py 98.46% <ø> (+1.44%) ⬆️
docarray/array/mixins/dataloader/__init__.py 100.00% <ø> (+25.00%) ⬆️
docarray/array/mixins/dataloader/helper.py 100.00% <ø> (+2.63%) ⬆️
docarray/array/mixins/delitem.py 86.66% <ø> (-0.57%) ⬇️
docarray/array/mixins/embed.py 92.30% <ø> (+2.83%) ⬆️
docarray/array/mixins/empty.py 100.00% <ø> (+12.50%) ⬆️
... and 154 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Copy Markdown
Member

@JoanFM JoanFM left a comment

Choose a reason for hiding this comment

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

Do not merge this. This should be fixed by Annlite or closed when ctxt manager leaves

@jemmyshin jemmyshin changed the title Fix annlite fix: fix annlite unit-test Oct 17, 2022
@numb3r3 numb3r3 changed the title fix: fix annlite unit-test fix(annlite): bump annlite to v0.4.0 Oct 17, 2022
return self._annlite.index_size

def close(self):
self._annlite.close()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do not think there is a close interface in DocArray

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is only for annlite backend. We need this because the file lock needed to be closed before access it again.


assert len(da) == 0
if da_cls == DocumentArrayAnnlite:
da.close()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove this, this is not what we are testing, we cannot test custom behavior like this. WE AIM FOR SAME interface

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you think we need to refactor the annlite-based test? We need to manually close it before another test starts. Otherwise, the file lock will block us.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do not like imposing the close API, this needs to be fix on ANNLite backend IMO

[d.embedding for d in da],
[d.content for d in da],
]
da.close()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove all these exceptions

@samsja
Copy link
Copy Markdown
Member

samsja commented Oct 18, 2022

Maybe instead of having a close method we can acquire and release the lock when using the

with da:
   ...

context manager

@JoanFM
Copy link
Copy Markdown
Member

JoanFM commented Oct 18, 2022

Maybe instead of having a close method we can acquire and release the lock when using the

with da:
   ...

context manager

This is a reasonable approach

@github-actions github-actions bot added size/s and removed size/m labels Oct 21, 2022
@jemmyshin jemmyshin marked this pull request as ready for review October 21, 2022 06:58
Copy link
Copy Markdown
Member

@JoanFM JoanFM left a comment

Choose a reason for hiding this comment

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

Please reenable the test that was disabled by @alaeddine-13 PR #649

@jemmyshin
Copy link
Copy Markdown
Contributor Author

Please reenable the test that was disabled by @alaeddine-13 PR #649

Done

Copy link
Copy Markdown
Contributor

@numb3r3 numb3r3 left a comment

Choose a reason for hiding this comment

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

LGTM

@jemmyshin jemmyshin mentioned this pull request Oct 21, 2022
1 task
da = cls()
assert getattr(da, content_attr) is None

if cls == DocumentArrayAnnlite:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for example here, DA will create an annlite instance with temp file name. I don't think anything would access the same temp file concurrently, why do we need to release the lock ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is because we need to test with different parameters, it's like a for loop, need to close it before another iteration.

@JoanFM
Copy link
Copy Markdown
Member

JoanFM commented Oct 24, 2022

I do not understand this PR. Now u are saying 0.4.0 is already released and all these tests were not failing even without closing. So why are we doing all this mess?

@jemmyshin
Copy link
Copy Markdown
Contributor Author

No, we haven't released annlite 0.4.0 yet. But when we release it, the docarray test will fail without these changes. So this is what this pr is doing: make sure the ci won't fail after 0.4.0 is released.

@JoanFM
Copy link
Copy Markdown
Member

JoanFM commented Oct 24, 2022

@jemmyshin I prefer then to have a PR fixing annlite version, and then pushing a change to unpin it and see what breaks and how

@JoanFM JoanFM closed this Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants