-
Notifications
You must be signed in to change notification settings - Fork 130
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: Refactored the way of warnings #864
Conversation
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
and running this code:
Clicking on /.../qdrant_client/check_depr.py:59 path should lead to |
qdrant_client/local/qdrant_local.py
Outdated
show_warning( | ||
message=f"Collection appears to be None before closing. The existing collections are: " | ||
f"{list(self.collections.keys())}", | ||
category=UserWarning, | ||
stacklevel=5, |
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.
stacklevel should be 4 and it should also be show_warning_once, since we don't provide collection name here
the output with stacklevel=5:
sys:1: UserWarning: Collection appears to be None before closing. The existing collections are: ['test']
stacklevel=4:
/.../qdrant_client/check_warnings/local_close_collection.py:6: UserWarning: Collection appears to be None before closing. The existing collections are: ['test']
cl.close()
/.../qdrant/qdrant_client/qdrant_client/qdrant_client.py:157: UserWarning: Collection appears to be None before closing. The existing collections are: ['test']
the script I used to reproduce:
from qdrant_client import QdrantClient, models
cl = QdrantClient(":memory:")
cl.create_collection('test', vectors_config=models.VectorParams(size=2, distance=models.Distance.COSINE))
cl._client.collections = {x: None for x in cl._client.collections}
cl.close()
qdrant_client/local/qdrant_local.py
Outdated
@@ -119,6 +121,7 @@ def _load(self) -> None: | |||
"with large datasets.", | |||
category=UserWarning, | |||
idx="large-local-collection", | |||
stacklevel=6, |
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.
might be show_warning, since we are providing collection name here
qdrant_client/qdrant_remote.py
Outdated
warnings.warn("Auth token provider is used with an insecure connection.") | ||
show_warning( | ||
message="Auth token provider is used with an insecure connection.", | ||
category=RuntimeWarning, |
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 it is UserWarning
qdrant_client/qdrant_remote.py
Outdated
warnings.warn("Api key is used with an insecure connection.") | ||
show_warning( | ||
message="Api key is used with an insecure connection.", | ||
category=RuntimeWarning, |
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 it is UserWarning
Also
is still using logging.warning Should be updated here qdrant-client/tools/async_client_generator/transformers/remote/function_def_transformer.py Line 38 in 9b89888
|
Co-authored-by: George <george.panchuk@qdrant.tech>
4978661
to
4bf910e
Compare
* refactor: Refactored the way of warnings * remove unused imports * fix: Fix stacklevel in warnings * regenerated async * nit * Updated some warnings with show once * fix: Fix stack levels * Updated async * Update qdrant_client/qdrant_remote.py Co-authored-by: George <george.panchuk@qdrant.tech> * Update async client * Updated warnings * Updated warnings * Updated warnings * fix: fix warning level * fix: fix warning level in async * fix: revert append payload condition --------- Co-authored-by: George <george.panchuk@qdrant.tech>
All Submissions:
dev
branch. Did you create your branch fromdev
?New Feature Submissions:
pre-commit
withpip3 install pre-commit
and set up hooks withpre-commit install
?Changes to Core Features: