-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat: add grpc reflection support #4585
Conversation
Latency summaryCurrent PR yields:
Breakdown
Backed by latency-tracking. Further commits will update this comment. |
Codecov Report
@@ Coverage Diff @@
## master #4585 +/- ##
=======================================
Coverage 87.70% 87.71%
=======================================
Files 117 117
Lines 8411 8464 +53
=======================================
+ Hits 7377 7424 +47
- Misses 1034 1040 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
b3aa042
to
1f6f514
Compare
async def send_requests( | ||
self, requests: List[Request], metadata, compression | ||
) -> Tuple: | ||
if not self._initialized: |
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.
can't we avoid this and simply initialize at __init__
time? I prefer a more stateless approach
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.
unfortunately not. The lazy init here is connecting to the server's grpc reflection endpoint, but the init is called on adding connections. At this time the server might not be ready yet. This is why I am delaying this until sending of the first data request. Then the server should be ready (or the request would fail anyway).
📝 Docs are deployed on https://feat-g2g-external--jina-docs.netlify.app 🎉 |
This PR allows external Executor to be fronted by our gRPC Gateway. This enables us to deploy external Executors together with a Gateway (as
Executor.serve()
is doing.). In theory this also allows us to integrate complete Flows as external Executors into another Flow. See the tests for some examples.Implementation details:
I've added support for gRPC reflection with this PR. When we add a new connection, we first check the available gRPC endpoints using reflection. This way we can figure out automatically if the GrpcConnctionPool is used to target a Worker/Head or Gateway. This is necessary because they have different gRPC interfaces (streaming and non streaming). There is no configuration necessary to enable this. The reflection call is done lazily before the first request is send to the target.
Closes #4556
Unblocks: #4502