From 4eb2ba6fe184c62e5a50a1b44e77d3ab2e3445cf Mon Sep 17 00:00:00 2001 From: "Ian (Hee) Cha" Date: Wed, 6 Sep 2023 10:50:09 -0700 Subject: [PATCH] [6.4.0] Revert "Report remote execution messages as events" (#19415) Since it makes it harder for BEP consumers to present the messages in a structured way. Fixes #19327. This reverts commit 6d089b3f399b993f296fab60966f1de9f07a3d0b. Closes #19347. Commit https://github.com/bazelbuild/bazel/commit/d3d167f3f6048d74e882b950189c06cbe234bf03 PiperOrigin-RevId: 562793125 Change-Id: I6ea41323c4ea98d416e4cfd9728d0d753aef9b5e Co-authored-by: Chi Wang --- .../build/lib/remote/RemoteSpawnRunner.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java index b23b585ab24e51..2c8b937ce19947 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java @@ -67,6 +67,7 @@ import com.google.devtools.build.lib.server.FailureDetails; import com.google.devtools.build.lib.server.FailureDetails.FailureDetail; import com.google.devtools.build.lib.util.ExitCode; +import com.google.devtools.build.lib.util.io.FileOutErr; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; import com.google.longrunning.Operation; @@ -288,7 +289,7 @@ public SpawnResult exec(Spawn spawn, SpawnExecutionContext context) // It's already late at this stage, but we should at least report once. reporter.reportExecutingIfNot(); - maybePrintExecutionMessages(spawn, result.getMessage(), result.success()); + maybePrintExecutionMessages(context, result.getMessage(), result.success()); profileAccounting(result.getExecutionMetadata()); spawnMetricsAccounting(spawnMetrics, result.getExecutionMetadata()); @@ -459,16 +460,14 @@ public boolean handlesCaching() { return true; } - private void maybePrintExecutionMessages(Spawn spawn, String message, boolean success) { + private void maybePrintExecutionMessages( + SpawnExecutionContext context, String message, boolean success) { + FileOutErr outErr = context.getFileOutErr(); boolean printMessage = remoteOptions.remotePrintExecutionMessages.shouldPrintMessages(success) && !message.isEmpty(); if (printMessage) { - report( - Event.info( - String.format( - "Remote execution message for %s %s: %s", - spawn.getMnemonic(), spawn.getTargetLabel(), message))); + outErr.printErr(message + "\n"); } } @@ -550,8 +549,7 @@ private SpawnResult handleError( } } if (e.isExecutionTimeout()) { - maybePrintExecutionMessages( - action.getSpawn(), e.getResponse().getMessage(), /* success= */ false); + maybePrintExecutionMessages(context, e.getResponse().getMessage(), /* success= */ false); return new SpawnResult.Builder() .setRunnerName(getName()) .setStatus(Status.TIMEOUT)