-
Notifications
You must be signed in to change notification settings - Fork 83
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
WIP on threadpool impl of query_namespaces #405
Conversation
attempts = 0 | ||
while attempts < retries: | ||
try: | ||
return func(*args, **kwargs) # Attempt to call __call_api |
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'm not a python expert, but isn;t there some library that provides a decorator to retry functions? seems like this should be a solved problem
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.
There's nothing in the standard library afaik, and I'm very hesitant to add third-party dependencies because of the overall dependency hell situation in python.
# aggregate them correctly. So we'll temporarily set topK to 2 for the | ||
# subqueries, and then we'll take the topK=1 results from the aggregated | ||
# results. | ||
overall_topk = top_k if top_k is not None else 10 |
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.
what is this magic number 10?
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.
It's just a default value. Could be anything, but the API requires a value to be passed.
Pursuing this in a different branch #409 |
Problem
I need a non-async interface providing a similar functionality as the
query_namespaces
currently implemented inGRPCIndexAsyncio
.Solution
Background info:
multiprocessing
ThreadPool is currently setup during the instantiation ofIndex
. The constructor takes a param for number ofpool_threads
with a default value of 1.async_req=True
, the underlying (generated from openapi spec) code will execute the request usingpool.apply_async
. The result of these calls is anApplyResult[QueryResult]
. To get the results, from these we call.get()
on theApplyResult
.New
query_namespaces
onIndex
:query
withasync_req=True
ApplyResults
into a results arrayQueryResultsAggregator
, recently implemented and tested in [Feat] asyncio for grpc data interactions #398Todo:
Usage
Dev build for manual testing
pip install pinecone==6.0.0.dev3
Type of Change
Test Plan
Describe specific steps for validating this change.