From a2177dc8f0f7da22aaef45d7c37d90b3013f5abd Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 22 Sep 2022 10:18:10 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 476133368 Change-Id: I137993aaeb12ea646416315cd1d56c83074f37f7 --- .../devtools/build/lib/bazel/Bazel.java | 2 +- ...pModule.java => ExecutionGraphModule.java} | 39 +++++++++---------- ...est.java => ExecutionGraphModuleTest.java} | 16 ++++---- 3 files changed, 28 insertions(+), 29 deletions(-) rename src/main/java/com/google/devtools/build/lib/runtime/{ExecutionGraphDumpModule.java => ExecutionGraphModule.java} (96%) rename src/test/java/com/google/devtools/build/lib/runtime/{ExecutionGraphDumpModuleTest.java => ExecutionGraphModuleTest.java} (98%) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/Bazel.java b/src/main/java/com/google/devtools/build/lib/bazel/Bazel.java index 3d1038592b512d..fb10eddbea35af 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/Bazel.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/Bazel.java @@ -78,7 +78,7 @@ public final class Bazel { com.google.devtools.build.lib.metrics.PostGCMemoryUseRecorder.GcAfterBuildModule.class, com.google.devtools.build.lib.packages.metrics.PackageMetricsModule.class, com.google.devtools.build.lib.metrics.MetricsModule.class, - com.google.devtools.build.lib.runtime.ExecutionGraphDumpModule.class, + com.google.devtools.build.lib.runtime.ExecutionGraphModule.class, BazelBuiltinCommandModule.class, com.google.devtools.build.lib.includescanning.IncludeScanningModule.class, // This module needs to be registered after any module submitting tasks with its {@code diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExecutionGraphDumpModule.java b/src/main/java/com/google/devtools/build/lib/runtime/ExecutionGraphModule.java similarity index 96% rename from src/main/java/com/google/devtools/build/lib/runtime/ExecutionGraphDumpModule.java rename to src/main/java/com/google/devtools/build/lib/runtime/ExecutionGraphModule.java index 58f9d1b169baf5..a68e7dad9183f1 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ExecutionGraphDumpModule.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ExecutionGraphModule.java @@ -81,14 +81,14 @@ import java.util.concurrent.atomic.AtomicLong; /** Blaze module that writes an partial execution graph with performance data. */ -public class ExecutionGraphDumpModule extends BlazeModule { +public class ExecutionGraphModule extends BlazeModule { private static final String ACTION_DUMP_NAME = "execution_graph_dump.proto.zst"; private static final GoogleLogger logger = GoogleLogger.forEnclosingClass(); /** Options for the generated execution graph. */ - public static class ExecutionGraphDumpOptions extends OptionsBase { + public static class ExecutionGraphOptions extends OptionsBase { @Option( name = "experimental_execution_graph_log", documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, @@ -128,7 +128,7 @@ public static class ExecutionGraphDumpOptions extends OptionsBase { documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, effectTags = {OptionEffectTag.UNKNOWN}, defaultValue = "false", - help = "Subscribe to ActionMiddlemanEvent in ExecutionGraphDumpModule.") + help = "Subscribe to ActionMiddlemanEvent in ExecutionGraphModule.") public boolean logMiddlemanActions; @Option( @@ -136,7 +136,7 @@ public static class ExecutionGraphDumpOptions extends OptionsBase { documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, effectTags = {OptionEffectTag.UNKNOWN}, defaultValue = "true", - help = "Subscribe to CachedActionEvent in ExecutionGraphDumpModule.") + help = "Subscribe to CachedActionEvent in ExecutionGraphModule.") public boolean logCachedActions; @Option( @@ -144,7 +144,7 @@ public static class ExecutionGraphDumpOptions extends OptionsBase { documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, effectTags = {OptionEffectTag.UNKNOWN}, defaultValue = "true", - help = "Subscribe to ActionCompletionEvent in ExecutionGraphDumpModule.") + help = "Subscribe to ActionCompletionEvent in ExecutionGraphModule.") public boolean logMissedActions; } @@ -164,14 +164,14 @@ public DependencyInfoConverter() { private ActionDumpWriter writer; private CommandEnvironment env; - private ExecutionGraphDumpOptions options; + private ExecutionGraphOptions options; private NanosToMillisSinceEpochConverter nanosToMillis = BlazeClock.createNanosToMillisSinceEpochConverter(); @Override public Iterable> getCommandOptions(Command command) { return "build".equals(command.name()) - ? ImmutableList.of(ExecutionGraphDumpOptions.class) + ? ImmutableList.of(ExecutionGraphOptions.class) : ImmutableList.of(); } @@ -181,7 +181,7 @@ void setWriter(ActionDumpWriter writer) { } @VisibleForTesting - void setOptions(ExecutionGraphDumpOptions options) { + void setOptions(ExecutionGraphOptions options) { this.options = options; } @@ -195,10 +195,10 @@ public void beforeCommand(CommandEnvironment env) { this.env = env; if (env.getCommand().builds()) { - ExecutionGraphDumpOptions options = + ExecutionGraphOptions options = Preconditions.checkNotNull( - env.getOptions().getOptions(ExecutionGraphDumpOptions.class), - "ExecutionGraphDumpOptions must be present for ExecutionGraphDumpModule"); + env.getOptions().getOptions(ExecutionGraphOptions.class), + "ExecutionGraphOptions must be present for ExecutionGraphModule"); if (!options.executionGraphLogFile.isBlank()) { env.getEventBus().register(this); } @@ -678,28 +678,28 @@ private ActionDumpWriter createActionDumpWriter(CommandEnvironment env) OptionsParsingResult parsingResult = env.getOptions(); BuildEventProtocolOptions bepOptions = Preconditions.checkNotNull(parsingResult.getOptions(BuildEventProtocolOptions.class)); - ExecutionGraphDumpOptions executionGraphDumpOptions = - Preconditions.checkNotNull(parsingResult.getOptions(ExecutionGraphDumpOptions.class)); + ExecutionGraphOptions executionGraphOptions = + Preconditions.checkNotNull(parsingResult.getOptions(ExecutionGraphOptions.class)); if (bepOptions.streamingLogFileUploads) { return new StreamingActionDumpWriter( env.getRuntime().getBugReporter(), env.getOptions().getOptions(LocalExecutionOptions.class).localLockfreeOutput, newUploader(env, bepOptions).startUpload(LocalFileType.PERFORMANCE_LOG, null), env.getCommandId(), - executionGraphDumpOptions.depType, - executionGraphDumpOptions.queueSize); + executionGraphOptions.depType, + executionGraphOptions.queueSize); } Path actionGraphFile = - env.getWorkingDirectory().getRelative(executionGraphDumpOptions.executionGraphLogFile); + env.getWorkingDirectory().getRelative(executionGraphOptions.executionGraphLogFile); try { return new FilesystemActionDumpWriter( env.getRuntime().getBugReporter(), env.getOptions().getOptions(LocalExecutionOptions.class).localLockfreeOutput, actionGraphFile, env.getCommandId(), - executionGraphDumpOptions.depType, - executionGraphDumpOptions.queueSize); + executionGraphOptions.depType, + executionGraphOptions.queueSize); } catch (IOException e) { throw new ActionDumpFileCreationException(actionGraphFile, e); } @@ -747,8 +747,7 @@ private static FailureDetail makeReportUploaderNeedsPackagePathsDetail() { private static FailureDetail makeReportWriteFailedDetail() { return FailureDetail.newBuilder() .setMessage("could not open action dump file for writing") - .setBuildReport( - BuildReport.newBuilder().setCode(Code.BUILD_REPORT_WRITE_FAILED)) + .setBuildReport(BuildReport.newBuilder().setCode(Code.BUILD_REPORT_WRITE_FAILED)) .build(); } diff --git a/src/test/java/com/google/devtools/build/lib/runtime/ExecutionGraphDumpModuleTest.java b/src/test/java/com/google/devtools/build/lib/runtime/ExecutionGraphModuleTest.java similarity index 98% rename from src/test/java/com/google/devtools/build/lib/runtime/ExecutionGraphDumpModuleTest.java rename to src/test/java/com/google/devtools/build/lib/runtime/ExecutionGraphModuleTest.java index 0f9458c86079eb..f7ca8ea8fcd259 100644 --- a/src/test/java/com/google/devtools/build/lib/runtime/ExecutionGraphDumpModuleTest.java +++ b/src/test/java/com/google/devtools/build/lib/runtime/ExecutionGraphModuleTest.java @@ -53,8 +53,8 @@ import com.google.devtools.build.lib.collect.nestedset.Order; import com.google.devtools.build.lib.exec.util.FakeOwner; import com.google.devtools.build.lib.exec.util.SpawnBuilder; -import com.google.devtools.build.lib.runtime.ExecutionGraphDumpModule.ActionDumpWriter; -import com.google.devtools.build.lib.runtime.ExecutionGraphDumpModule.DependencyInfo; +import com.google.devtools.build.lib.runtime.ExecutionGraphModule.ActionDumpWriter; +import com.google.devtools.build.lib.runtime.ExecutionGraphModule.DependencyInfo; import com.google.devtools.build.lib.testutil.FoundationTestCase; import com.google.devtools.build.lib.util.OS; import com.google.devtools.build.lib.vfs.PathFragment; @@ -73,15 +73,15 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -/** Unit tests for {@link ExecutionGraphDumpModule}. */ +/** Unit tests for {@link ExecutionGraphModule}. */ @RunWith(TestParameterInjector.class) -public class ExecutionGraphDumpModuleTest extends FoundationTestCase { - private ExecutionGraphDumpModule module; +public class ExecutionGraphModuleTest extends FoundationTestCase { + private ExecutionGraphModule module; private ArtifactRoot artifactRoot; @Before public void createModule() { - module = new ExecutionGraphDumpModule(); + module = new ExecutionGraphModule(); } @Before @@ -371,7 +371,7 @@ public void spawnAndAction_withSameOutputs() throws Exception { var buffer = new ByteArrayOutputStream(); startLogging(eventBus, UUID.randomUUID(), buffer, DependencyInfo.ALL); - var options = new ExecutionGraphDumpModule.ExecutionGraphDumpOptions(); + var options = new ExecutionGraphModule.ExecutionGraphOptions(); options.logMissedActions = true; module.setOptions(options); @@ -405,7 +405,7 @@ public void spawnAndAction_withDifferentOutputs() throws Exception { var buffer = new ByteArrayOutputStream(); startLogging(eventBus, UUID.randomUUID(), buffer, DependencyInfo.ALL); - var options = new ExecutionGraphDumpModule.ExecutionGraphDumpOptions(); + var options = new ExecutionGraphModule.ExecutionGraphOptions(); options.logMissedActions = true; module.setOptions(options); var nanosToMillis = BlazeClock.createNanosToMillisSinceEpochConverter();