From 89288800119da6f6f02bb1b2d73d6dcec8ba91ee Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 26 Nov 2024 07:09:27 -0800 Subject: [PATCH] Improve the debug logging when dynamic execution is forced to run only remotely. RELNOTE: None PiperOrigin-RevId: 700331056 Change-Id: I249f03814cbc25248fefd7620d1e86aacefb7a20 --- .../lib/dynamic/DynamicSpawnStrategy.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/dynamic/DynamicSpawnStrategy.java b/src/main/java/com/google/devtools/build/lib/dynamic/DynamicSpawnStrategy.java index 2d50cb2a48d84e..28b5f266197a01 100644 --- a/src/main/java/com/google/devtools/build/lib/dynamic/DynamicSpawnStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/dynamic/DynamicSpawnStrategy.java @@ -399,12 +399,24 @@ ImmutableList maybeExecuteNonDynamically( getSpawnReadableId(spawn)); throw new UserExecException(failure); } else if (!localCanExec && remoteCanExec) { + String spawnExplanation = + String.format( + "Local execution policy of the spawn %s dynamic execution, local strategies of the" + + " spawn are %s", + executionPolicy.canRunLocally() ? "allows" : "forbids", + dynamicStrategyRegistry.getDynamicSpawnActionContexts(spawn, DynamicMode.LOCAL)); + String postProcessingSpawnExplanation = + postProcessingSpawn == null + ? "the post-processing spawn doesn't exist" + : String.format( + "local execution policy of the post-processing spawn %s dynamic execution, local" + + " strategies of the post-processing spawn are %s", + postProcessingSpawnExecutionPolicy.canRunLocally() ? "allows" : "forbids", + dynamicStrategyRegistry.getDynamicSpawnActionContexts( + postProcessingSpawn, DynamicMode.LOCAL)); debugLog( - "Dynamic execution of %s can only be done remotely: Local execution policy %s it, " - + "local strategies are %s.%n", - getSpawnReadableId(spawn), - executionPolicy.canRunLocally() ? "allows" : "forbids", - dynamicStrategyRegistry.getDynamicSpawnActionContexts(spawn, DynamicMode.LOCAL)); + "Dynamic execution of %s can only be done remotely: %s. And %s.%n", + getSpawnReadableId(spawn), spawnExplanation, postProcessingSpawnExplanation); return RemoteBranch.runRemotely(spawn, actionExecutionContext, null, delayLocalExecution); } else if (localCanExec && !remoteCanExec) { debugLog(