diff options
author | Googler <noreply@google.com> | 2017-11-28 10:23:53 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2017-11-28 10:26:10 -0800 |
commit | 6e978a3fe2c38c4a2dcfba27778c4961e1d38c9c (patch) | |
tree | ab4c2f263e2c3f009e5849a8008e1cded90b19c4 /src/main/java/com/google/devtools/build/lib | |
parent | d0f06a6e4b61adc39bf5e1cfbae39501a89dc8e3 (diff) |
Print 'waiting for other blaze command' on its own line.
It now prints a newline char immediately, rather than waiting until
the lock is released, and printing 'done!' at the end of the line.
This allows per-line parsers (like IntelliJ) to display this progress
notification without special-case hacks.
PiperOrigin-RevId: 177180918
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java index 7653fd892f..0cab34771d 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java @@ -175,7 +175,7 @@ public class BlazeCommandDispatcher { // holding the lock has changed under the hood. There have been multiple bug reports where // users (especially macOS ones) mention that the Blaze invocation hangs on a non-existent PID. // This should help troubleshoot those scenarios in case there really is a bug somewhere. - int attempts = 0; + boolean multipleAttempts = false; long clockBefore = BlazeClock.nanoTime(); String otherClientDescription = ""; synchronized (commandLock) { @@ -183,10 +183,7 @@ public class BlazeCommandDispatcher { switch (lockingMode) { case WAIT: if (!otherClientDescription.equals(currentClientDescription)) { - if (attempts > 0) { - outErr.printErrLn(" lock taken by another command"); - } - outErr.printErr("Another command (" + currentClientDescription + ") is running. " + outErr.printErrLn("Another command (" + currentClientDescription + ") is running. " + " Waiting for it to complete on the server..."); otherClientDescription = currentClientDescription; } @@ -202,18 +199,16 @@ public class BlazeCommandDispatcher { throw new IllegalStateException(); } - attempts += 1; + multipleAttempts = true; } Verify.verify(currentClientDescription == null); currentClientDescription = clientDescription; } - if (attempts > 0) { - outErr.printErrLn(" done!"); - } // If we took the lock on the first try, force the reported wait time to 0 to avoid unnecessary // noise in the logs. In this metric, we are only interested in knowing how long it took for // other commands to complete, not how fast acquiring a lock is. - long waitTimeInMs = attempts == 0 ? 0 : (BlazeClock.nanoTime() - clockBefore) / (1000L * 1000L); + long waitTimeInMs = + !multipleAttempts ? 0 : (BlazeClock.nanoTime() - clockBefore) / (1000L * 1000L); try { if (shutdownReason != null) { |