YARN-2597 MiniYARNCluster should propagate reason for AHS not starting

This commit is contained in:
Steve Loughran 2015-09-18 09:45:17 +01:00
parent 723c31d45b
commit a7201d635f
2 changed files with 24 additions and 21 deletions

View File

@ -445,6 +445,9 @@ Release 2.8.0 - UNRELEASED
YARN-4149. yarn logs -am should provide an option to fetch all the log files YARN-4149. yarn logs -am should provide an option to fetch all the log files
(Varun Vasudev via xgong) (Varun Vasudev via xgong)
YARN-2597. MiniYARNCluster should propagate reason for AHS not starting.
(stevel)
OPTIMIZATIONS OPTIMIZATIONS
YARN-3339. TestDockerContainerExecutor should pull a single image and not YARN-3339. TestDockerContainerExecutor should pull a single image and not

View File

@ -37,6 +37,7 @@ import org.apache.hadoop.ha.HAServiceProtocol;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.service.CompositeService; import org.apache.hadoop.service.CompositeService;
import org.apache.hadoop.service.ServiceStateException;
import org.apache.hadoop.util.Shell; import org.apache.hadoop.util.Shell;
import org.apache.hadoop.util.Shell.ShellCommandExecutor; import org.apache.hadoop.util.Shell.ShellCommandExecutor;
import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsRequest;
@ -708,32 +709,31 @@ public class MiniYARNCluster extends CompositeService {
@Override @Override
protected synchronized void serviceStart() throws Exception { protected synchronized void serviceStart() throws Exception {
try {
new Thread() { new Thread() {
public void run() { public void run() {
appHistoryServer.start(); appHistoryServer.start();
}; };
}.start(); }.start();
int waitCount = 0; int waitCount = 0;
while (appHistoryServer.getServiceState() == STATE.INITED while (appHistoryServer.getServiceState() == STATE.INITED
&& waitCount++ < 60) { && waitCount++ < 60) {
LOG.info("Waiting for Timeline Server to start..."); LOG.info("Waiting for Timeline Server to start...");
Thread.sleep(1500); Thread.sleep(1500);
} }
if (appHistoryServer.getServiceState() != STATE.STARTED) { if (appHistoryServer.getServiceState() != STATE.STARTED) {
// AHS could have failed. // AHS could have failed.
throw new IOException( IOException ioe = new IOException(
"ApplicationHistoryServer failed to start. Final state is " "ApplicationHistoryServer failed to start. Final state is "
+ appHistoryServer.getServiceState()); + appHistoryServer.getServiceState());
} ioe.initCause(appHistoryServer.getFailureCause());
super.serviceStart(); throw ioe;
} catch (Throwable t) {
throw new YarnRuntimeException(t);
} }
LOG.info("MiniYARN ApplicationHistoryServer address: " LOG.info("MiniYARN ApplicationHistoryServer address: "
+ getConfig().get(YarnConfiguration.TIMELINE_SERVICE_ADDRESS)); + getConfig().get(YarnConfiguration.TIMELINE_SERVICE_ADDRESS));
LOG.info("MiniYARN ApplicationHistoryServer web address: " LOG.info("MiniYARN ApplicationHistoryServer web address: "
+ getConfig().get(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS)); + getConfig().get(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS));
super.serviceStart();
} }
@Override @Override