-
Notifications
You must be signed in to change notification settings - Fork 123
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
base: dev
Are you sure you want to change the base?
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 |
@@ -4,12 +4,15 @@ | |||
SEEN_MESSAGES = set() | |||
|
|||
|
|||
def show_warning(message: str, category: type[Warning] = UserWarning) -> None: | |||
warnings.warn(message, category, stacklevel=4) | |||
def show_warning(message: str, category: type[Warning] = UserWarning, stacklevel: int = 1) -> None: |
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.
let's use the stacklevel which we are using the most (2 or 4 i guess)
qdrant_client/local/qdrant_local.py
Outdated
show_warning_once( | ||
message="Payload indexes have no effect in the local Qdrant. Please use server Qdrant if you need payload indexes.", | ||
category=UserWarning, | ||
idx="server-payload-indexes", |
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.
let's separate create and delete payload index
qdrant_client/qdrant_remote.py
Outdated
@@ -3043,7 +3062,11 @@ def create_payload_index( | |||
**kwargs: Any, | |||
) -> types.UpdateResult: | |||
if field_type is not None: | |||
warnings.warn("field_type is deprecated, use field_schema instead", DeprecationWarning) | |||
show_warning( |
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.
should be show_warning_once
qdrant_client/qdrant_remote.py
Outdated
@@ -2763,7 +2780,9 @@ def create_collection( | |||
**kwargs: Any, | |||
) -> bool: | |||
if init_from is not None: | |||
logging.warning("init_from is deprecated") | |||
show_warning( |
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.
should be show_warning_once
qdrant_client/qdrant_remote.py
Outdated
show_warning( | ||
message="async_grpc_snapshots is deprecated and will be removed in a future release. Use `AsyncQdrantRemote.grpc_snapshots` instead.", | ||
category=DeprecationWarning, |
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.
we can't change warnings here since IDE stop striking them through
qdrant_client/qdrant_remote.py
Outdated
show_warning( | ||
message="async_grpc_root is deprecated and will be removed in a future release. Use `AsyncQdrantRemote.grpc_root` instead.", | ||
category=DeprecationWarning, |
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.
same about striking through
qdrant_client/qdrant_remote.py
Outdated
@@ -492,8 +507,10 @@ def search( | |||
**kwargs: Any, | |||
) -> list[types.ScoredPoint]: | |||
if not append_payload: | |||
logging.warning( | |||
"Usage of `append_payload` is deprecated. Please consider using `with_payload` instead" | |||
show_warning( |
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.
should be show_warning_once
show_warning( | ||
message=f"Batch upload failed {attempt + 1} times. Retrying...", | ||
category=UserWarning, | ||
stacklevel=1, |
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.
seems that it should be 7
show_warning( | ||
message=f"Batch upload failed {attempt + 1} times. Retrying...", | ||
category=UserWarning, | ||
stacklevel=1, |
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.
seems that it should be 8
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.
This one does not reproduce show_warning message, but raises RuntimeError("Thread unexpectedly terminated") if the qdrant is stopped
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.
@I8dNLo it retries 3 times (by default) with warning then raises.
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: