Asyncio for data plane calls#435
Merged
jhamon merged 15 commits intorelease-candidate/2025-01from Jan 28, 2025
Merged
Conversation
…y, update, list, describe_index_stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The purpose of this PR is to introduce a class,
AsyncioIndexthat provides an async version of the functionality found in theIndexclient. This includes standard index data plane operations such asupsert,query, etc as well as bulk import operations (start_import,list_imports, etc).Solution
This is a very complex diff with many moving parts.
aiohttp, an asyncio-compatible http client.pytest-asyncioto support async testingpinecone/openapi_supportto introduce asyncio-variants of existing classes:AsyncioApiClient,AsyncioEndpoint, andAiohttpRestClient. I don't love the way any of these are currently laid out, but for simplicity sake I decided to hew close to the existing organization since this was already going to be a complex change.AsyncioVectorOperationsApi) objects and reference the objects named above.AsyncioIndexthat uses these asyncio variant objects. Since the majority of the logic (validation, etc) inside each data plane method ofIndexwas previously extracted intoIndexRequestFactory, the amount of actual new code needed inside this class was minimal async from signature changes to useasync/await.Also:
ddtracedev dependency for logging test info in datadog. This was giving me a lot of annoying errors when running tests locally. I will troubleshoot and bring it back in later.jinjaandvirtualenvversions in our poetry.lock file to resolve dependabot alertsUsage
In a standalone script, you might do something like this:
Type of Change
Test Plan
Describe specific steps for validating this change.