Skip to content

Add "primary output" to RequestMetadata #349

@sluongng

Description

@sluongng

In Bazel, there are many cases where a combination of <target label> + <action mnemonic> - <configuration> is not sufficient to identify an action.

For example, given a cc_library target with a lot of source files

cc_library(
    name = "foo",
    srcs = [
        "foo1.cc",
        "foo2.cc",
        "foo3.cc",
    ],
    hdrs = ["foo.h"],
)

Then there will be 3 separate CcCompile actions with the identical combination above.
This is unfortunate because our RequestMetadata message is mapping to that exact combination and therefore, makes it challenging for servers to differentiate ByteStream.Write requests that were made for CcCompile(foo1.cc) and CcCompile(foo2.cc).

The solution for this, unfortunately, is to add another field to RequestMetadata:

--- a/proto/remote_execution.proto
+++ b/proto/remote_execution.proto
@@ -2486,6 +2486,10 @@ message RequestMetadata {
   // or equality across invocations, though some client tools may offer these guarantees.
   string configuration_id = 7;

+  // An identifier for the expected set of outputs which are produced by this action.
+  // e.g. the first entry among the [Command][build.bazel.remote.execution.v2.Command]'s output_paths.
+  string primary_output = 8;
+

This way, we can avoid breaking server/client relying on existing fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions