ambari git commit: AMBARI-10294. Usability: bootstrapping hosts shows "Preparing" without any information and seems stuck (dlysnichenko)
Repository: ambari Updated Branches: refs/heads/trunk e5fb8d72c -> b4d7b388b AMBARI-10294. Usability: bootstrapping hosts shows "Preparing" without any information and seems stuck (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b4d7b388 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b4d7b388 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b4d7b388 Branch: refs/heads/trunk Commit: b4d7b388b289cac955171914e8066152633ae0a5 Parents: e5fb8d7 Author: Lisnichenko Dmitro Authored: Thu Apr 23 17:04:01 2015 +0300 Committer: Lisnichenko Dmitro Committed: Thu Apr 23 17:04:57 2015 +0300 -- .../server/bootstrap/BSHostStatusCollector.java | 3 +- .../ambari/server/bootstrap/BSRunner.java | 70 +++- 2 files changed, 39 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/b4d7b388/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java index cf3ee64..661f284 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java @@ -113,7 +113,8 @@ class BSHostStatusCollector { logString = sb.toString(); } catch (IOException e) { - LOG.info("Error reading log file " + log); + LOG.info("Error reading log file " + log + + ". Log file may be have not created yet"); } finally { try { http://git-wip-us.apache.org/repos/asf/ambari/blob/b4d7b388/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java index fe873d7..0a55131 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java @@ -18,6 +18,7 @@ package org.apache.ambari.server.bootstrap; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.util.*; @@ -25,7 +26,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import static org.apache.ambari.server.bootstrap.BSHostStatusCollector.doneFileFilter; import org.apache.ambari.server.bootstrap.BootStrapStatus.BSStat; import org.apache.commons.io.FileUtils; @@ -152,6 +152,13 @@ class BSRunner extends Thread { @Override public void run() { String hostString = createHostString(sshHostInfo.getHosts()); +// Startup a scheduled executor service to look through the logs +ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); +BSStatusCollector statusCollector = new BSStatusCollector(); +ScheduledFuture handle = scheduler.scheduleWithFixedDelay(statusCollector, +0, 10, TimeUnit.SECONDS); +LOG.info("Kicking off the scheduler for polling on logs in " + +this.requestIdDir); String user = sshHostInfo.getUser(); String userRunAs = sshHostInfo.getUserRunAs(); if (user == null || user.isEmpty()) { @@ -251,14 +258,6 @@ class BSRunner extends Thread { stdErrWriter.close(); } - - // Startup a scheduled executor service to look through the logs - ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); - BSStatusCollector statusCollector = new BSStatusCollector(); - ScheduledFuture handle = scheduler.scheduleWithFixedDelay(statusCollector, - 0, 10, TimeUnit.SECONDS); - LOG.info("Kicking off the scheduler for polling on logs in " + - this.requestIdDir); try { String logInfoMessage = "Bootstrap output, log=" + bootStrapErrorFilePath + " " + bootStrapOutputFilePath + " at " + this.ambariHostname; @@ -272,34 +271,11 @@ class BSRunner extends Thread { } catch(IOException io) { LOG.info("Error in reading files ", io); } -PrintWriter setupAgentDoneWriter = null; -PrintWriter setupAgentLogWriter = null; -try { - if (exitCode != 0) { -for (String host : hostString.split(",")) { -
ambari git commit: AMBARI-10294. Usability: bootstrapping hosts shows "Preparing" without any information and seems stuck (dlysnichenko)
Repository: ambari Updated Branches: refs/heads/trunk 16e96dda7 -> 75f9c51f6 AMBARI-10294. Usability: bootstrapping hosts shows "Preparing" without any information and seems stuck (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/75f9c51f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/75f9c51f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/75f9c51f Branch: refs/heads/trunk Commit: 75f9c51f631155aea350c3a29e8df11a36ac37a1 Parents: 16e96dd Author: Lisnichenko Dmitro Authored: Wed Apr 1 18:38:29 2015 +0300 Committer: Lisnichenko Dmitro Committed: Wed Apr 1 18:38:29 2015 +0300 -- .../server/bootstrap/BSHostStatusCollector.java | 4 +-- .../ambari/server/bootstrap/BSRunner.java | 33 +--- 2 files changed, 31 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/75f9c51f/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java index 8754ba9..cf3ee64 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java @@ -36,8 +36,8 @@ import org.apache.commons.logging.LogFactory; class BSHostStatusCollector { private File requestIdDir; private List hostStatus; - private static final String logFileFilter = ".log"; - private static final String doneFileFilter = ".done"; + public static final String logFileFilter = ".log"; + public static final String doneFileFilter = ".done"; private static Log LOG = LogFactory.getLog(BSHostStatusCollector.class); private List hosts; http://git-wip-us.apache.org/repos/asf/ambari/blob/75f9c51f/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java index 8c27934..331b309 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java @@ -26,6 +26,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import static org.apache.ambari.server.bootstrap.BSHostStatusCollector.doneFileFilter; import org.apache.ambari.server.bootstrap.BootStrapStatus.BSStat; import org.apache.commons.io.FileUtils; @@ -238,18 +239,42 @@ class BSRunner extends Thread { LOG.info("Kicking off the scheduler for polling on logs in " + this.requestIdDir); try { - -LOG.info("Bootstrap output, log=" - + bootStrapErrorFilePath + " " + bootStrapOutputFilePath); +String logInfoMessage = "Bootstrap output, log=" + + bootStrapErrorFilePath + " " + bootStrapOutputFilePath + " at " + this.ambariHostname; +LOG.info(logInfoMessage); int exitCode = process.waitFor(); String outMesg = ""; -String errMesg = ""; +String errMesg = ""; try { outMesg = FileUtils.readFileToString(new File(bootStrapOutputFilePath)); errMesg = FileUtils.readFileToString(new File(bootStrapErrorFilePath)); } catch(IOException io) { LOG.info("Error in reading files ", io); } +PrintWriter setupAgentDoneWriter = null; +PrintWriter setupAgentLogWriter = null; +try { + if (exitCode != 0) { +for (String host : hostString.split(",")) { + setupAgentDoneWriter = new PrintWriter(new File(requestIdDir, host + BSHostStatusCollector.doneFileFilter)); + setupAgentLogWriter = new PrintWriter(new File(requestIdDir, host + BSHostStatusCollector.logFileFilter)); + setupAgentLogWriter.print(logInfoMessage + "\n Error while bootstrapping:\n" + errMesg); + setupAgentDoneWriter.print(exitCode); + setupAgentDoneWriter.close(); + setupAgentLogWriter.close(); +} + + } +} finally { + if (setupAgentDoneWriter != null) { +setupAgentDoneWriter.close(); + } + + if (setupAgentLogWriter != null) { +setupAgentLogWriter.close(); +