Skip to content

Fix exception handling - #14

Merged
mutayroei merged 13 commits into
mainfrom
10321
Dec 12, 2021
Merged

mutayroei merged 13 commits into
mainfrom
10321

Conversation

@rajat08

@rajat08 rajat08 commented Nov 25, 2021

Copy link
Copy Markdown
Contributor

No description provided.

@rajat08
rajat08 requested a review from benjaminran November 25, 2021 01:08
@mutayroei

Copy link
Copy Markdown
Contributor

[ch10321]

@shortcut-integration

Copy link
Copy Markdown

This pull request has been linked to Shortcut Story #10321: Async in gRPC client.

Comment thread pinecone/core/grpc/index_grpc.py Resolved
@mutayroei

Copy link
Copy Markdown
Contributor

@benjaminran can you review?

@rajat08

rajat08 commented Dec 1, 2021 •

Copy link
Copy Markdown
Contributor Author

@mutayroei @benjaminran
Since all the info form the grpc error is condensed in the debug string, we can pass this to PineconeException and get a 'nicer sounding' error. However _InactiveRPCError would be visible in the trace. Would the ideal behavior be to raise PineconeException at an earlier step?

@benjaminran benjaminran left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Posted a couple comments about the async logic.

The error handling logic looks good! I think it's a good thing to include the _InactiveRpcError deeper inside the trace.

Comment thread pinecone/core/grpc/index_grpc.py Resolved
Comment thread pinecone/core/grpc/index_grpc.py Outdated
try:
if not async_req:
return parse_upsert_response(self._wrap_grpc_call(self.stub.Upsert, request, timeout=timeout))
return self.executor.submit(self._wrap_grpc_call, self.stub.Upsert, request, timeout=timeout)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

grpc-python already has async support - putting this ThreadpoolExecutor here is adding an unnecessary thread in the picture, which we can do away with if we use the existing grpc-python async interface (anyways grpc is managing the threads making the actual requests). See https://grpc.io/docs/languages/python/basics/#simple-rpc-1 > "An asynchronous call to GetFeature is similar...".

This also would also save us and users from a fair bit of complexity - e.g. users having to update both our timeout and the grpc request deadline, both our threadpool size and maybe the grpc threadpool size.

Secondly, we should at least make the write operations both support async (i.e. add delete too) if either of them supports it. And maybe it's easy enough to add for all operations?

@mutayroei mutayroei changed the title Async grpc upsert Fix exception handling Dec 11, 2021
@mutayroei
mutayroei merged commit 32acacb into main Dec 12, 2021
@rajat08
rajat08 deleted the 10321 branch June 8, 2022 13:38
jhamon added a commit that referenced this pull request Aug 26, 2026
…920d

ci: add Python 3.14 to the test matrix
jhamon added a commit that referenced this pull request Oct 7, 2026
Closes the critical Dependabot alert (#15, AnyIO TLSStream IDNA 2003
host name encoding) and the medium one (#14, process-pool stderr
blocking). typing-extensions moves to 4.16.0 because anyio 4.15 requires it.
The dev-group floor goes to 4.14.2 so a re-resolve cannot land on a
vulnerable version.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants