Skip to content
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

Include invocation ID in compact execution log #24790

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ private void initOutputs(CommandEnvironment env) throws IOException {
.experimentalSiblingRepositoryLayout,
env.getOptions().getOptions(RemoteOptions.class),
env.getRuntime().getFileSystem().getDigestFunction(),
env.getXattrProvider());
env.getXattrProvider(),
env.getCommandId());
} catch (InterruptedException e) {
env.getReporter()
.handle(Event.error("Error while setting up the execution log: " + e.getMessage()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import java.util.Comparator;
import java.util.List;
import java.util.SortedMap;
import java.util.UUID;
import java.util.concurrent.ForkJoinPool;
import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
Expand Down Expand Up @@ -143,6 +144,7 @@ private interface ExecLogEntrySupplier {
@Nullable private final RemoteOptions remoteOptions;
private final DigestHashFunction digestHashFunction;
private final XattrProvider xattrProvider;
private final UUID invocationId;

// Maps a key identifying an entry into its ID.
// Each key is either a NestedSet.Node or the String path of a file, directory, symlink or
Expand All @@ -166,14 +168,16 @@ public CompactSpawnLogContext(
boolean siblingRepositoryLayout,
@Nullable RemoteOptions remoteOptions,
DigestHashFunction digestHashFunction,
XattrProvider xattrProvider)
XattrProvider xattrProvider,
UUID invocationId)
throws IOException, InterruptedException {
this.execRoot = execRoot;
this.workspaceName = workspaceName;
this.siblingRepositoryLayout = siblingRepositoryLayout;
this.remoteOptions = remoteOptions;
this.digestHashFunction = digestHashFunction;
this.xattrProvider = xattrProvider;
this.invocationId = invocationId;
this.outputStream = getOutputStream(outputPath);

logInvocation();
Expand All @@ -194,7 +198,8 @@ private void logInvocation() throws IOException, InterruptedException {
ExecLogEntry.Invocation.newBuilder()
.setHashFunctionName(digestHashFunction.toString())
.setWorkspaceRunfilesDirectory(workspaceName)
.setSiblingRepositoryLayout(siblingRepositoryLayout)));
.setSiblingRepositoryLayout(siblingRepositoryLayout)
.setId(invocationId.toString())));
}

@Override
Expand Down
3 changes: 3 additions & 0 deletions src/main/protobuf/spawn.proto
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ message ExecLogEntry {

// Whether --experimental_sibling_repository_layout is enabled.
bool sibling_repository_layout = 3;

// The ID of the invocation.
string id = 4;
}

// An input or output file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.UUID;
import net.starlark.java.syntax.Location;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -144,7 +145,8 @@ public void testSymlinkAction() throws IOException, InterruptedException {
Protos.ExecLogEntry.Invocation.newBuilder()
.setHashFunctionName("SHA-256")
.setWorkspaceRunfilesDirectory(TestConstants.WORKSPACE_NAME)
.setSiblingRepositoryLayout(siblingRepositoryLayout))
.setSiblingRepositoryLayout(siblingRepositoryLayout)
.setId("00000000-0000-0000-0000-000000000000"))
.build(),
Protos.ExecLogEntry.newBuilder()
.setSymlinkAction(
Expand Down Expand Up @@ -244,7 +246,8 @@ protected SpawnLogContext createSpawnLogContext(ImmutableMap<String, String> pla
siblingRepositoryLayout,
remoteOptions,
DigestHashFunction.SHA256,
SyscallCache.NO_CACHE);
SyscallCache.NO_CACHE,
UUID.fromString("00000000-0000-0000-0000-000000000000"));
}

@Override
Expand Down
Loading