You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2015/04/01 17:39:27 UTC
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 <dl...@hortonworks.com>
Authored: Wed Apr 1 18:38:29 2015 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
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<BSHostStatus> 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<String> 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();
+ }
+ }
+
scriptlog = outMesg + "\n\n" + errMesg;
LOG.info("Script log Mesg " + scriptlog);
if (exitCode != 0) {