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

[6.1.0]Add a flag to disable execution log sorting. #17505

Merged
merged 1 commit into from
Feb 16, 2023
Merged
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
1 change: 1 addition & 0 deletions src/main/java/com/google/devtools/build/lib/bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/util/io",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/protobuf:failure_details_java_proto",
"//src/main/protobuf:spawn_java_proto",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.devtools.build.lib.exec.ExecutionOptions;
import com.google.devtools.build.lib.exec.ExecutorBuilder;
import com.google.devtools.build.lib.exec.ModuleActionContextRegistry;
import com.google.devtools.build.lib.exec.Protos.SpawnExec;
import com.google.devtools.build.lib.exec.SpawnLogContext;
import com.google.devtools.build.lib.remote.options.RemoteOptions;
import com.google.devtools.build.lib.runtime.BlazeModule;
Expand Down Expand Up @@ -162,7 +163,14 @@ public void afterCommand() throws AbruptExitException {
spawnLogContext.close();
if (!outputStreams.isEmpty()) {
InputStream in = rawOutput.getInputStream();
StableSort.stableSort(in, outputStreams);
if (spawnLogContext.shouldSort()) {
StableSort.stableSort(in, outputStreams);
} else {
while (in.available() > 0) {
SpawnExec ex = SpawnExec.parseDelimitedFrom(in);
outputStreams.write(ex);
}
}
outputStreams.close();
}
done = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,17 @@ public boolean usingLocalTestJobs() {
+ " --subcommands (for displaying subcommands in terminal output).")
public PathFragment executionLogJsonFile;

@Option(
name = "execution_log_sort",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
help =
"Whether to sort the execution log. Set to false to improve memory"
+ " performance, at the cost of producing the log in nondeterministic"
+ " order.")
public boolean executionLogSort;

@Option(
name = "experimental_split_xml_generation",
defaultValue = "true",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,8 @@ private Digest computeDigest(
.setSizeBytes(fileSize)
.build();
}

public boolean shouldSort() {
return executionOptions.executionLogSort;
}
}