-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Pass --remote_header's headers to grpc endpoints #10015
Pass --remote_header's headers to grpc endpoints #10015
Conversation
a7dde66
to
08a3cd2
Compare
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.
Thanks for the PR! Can you please add a test to ensure that this actually works and we don't regress?
Can you please explain why headers for caching and execution have different flags? I am somewhat surprised given that Bazel doesn't allow you to mix caching and execution in one invocation.
} | ||
if (remoteOptions.remoteCacheHeaders.size() > 0) { | ||
cacheInterceptors = new ArrayList<>(interceptors); | ||
cacheInterceptors.add(createExtraHeadersClientInterceptor(remoteOptions.remoteCacheHeaders)); |
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.
Instead of adding the headers in the module, consider passing the headers to the RemoteSpawnRunner. That way it's easier to write a unit test.
Bazel does allow to have two different endpoints for cache and executor doesn't it? The idea there was that if both |
@AlessandroPatti yes we do but I don't know of anyone setting these two to different values or both at the same time. If you set So for now I'd prefer to just reuse |
We are using separate services for the CAS and the Scheduler, and therefore require different endpoints for both. I though that Bazel now creates 2 different connections. |
We do have such use case already. We want to add different headers to cache and execution requests. Now that I think about it, it is not really necessary for the two endpoint to be different, different headers might be necessary according to the request type. |
Makes sense. Let's figure out how to keep flags sane then :-). I don't want to have 3 different flags. How about:
|
If we want to pass a header for the CAS and a header for execution the request would look like:
I think it would be better to have a flag that allow us to specify a cas specific header so that it's more explicit what's happening.
And, alternatively have a |
I'd also add that it would not be possible to pass a header to the CAS and not to the executor. |
@werkt thoughts on this? |
List<ClientInterceptor> execInterceptors = interceptors; | ||
List<ClientInterceptor> cacheInterceptors = interceptors; |
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 will use the same referenced list for all of the interceptors, which definitely is not what you want. You would need separate List instances, likely with interceptors populated below copied in, to effect different sets of interceptors.
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 see the reassignment below accomplishes this, but a bit awkwardly. Composition via a list view would be preferred, as jakob mentioned below, as a parameter to RemoteSpawnRunner instantiation, just so you don't have the potential for reference duplication, and don't have to rely on reference equality.
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 am not sure what you meant here. How should the headers be passed with the RemoteSpawnRunner
? Also, that module takes care only of remote execution, doesn't it? In that case, how to pass the headers to the cache too?
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.
Coordinated offline. New changes look good, ty.
b149fd2
to
9873e84
Compare
9873e84
to
19a4d2e
Compare
Moved the code outside the |
cc @ola-rozenfeld @ishikhman |
👍 |
@buchgr Could you please review these changes? It is the last missing piece for us and we'd love to see it in the next release |
Extends bazelbuild#8245 to gRPC. Closes bazelbuild#10015. PiperOrigin-RevId: 286175898
Extends #8245 to gRPC.