use of org.apache.slider.api.types.ContainerInformation in project hive by apache.
the class LlapStatusServiceDriver method processAppDiagnostics.
private static void processAppDiagnostics(AppStatusBuilder appStatusBuilder, ApplicationDiagnostics appDiagnostics, boolean appComplete) {
// For a running app this should be empty.
String finalMessage = appDiagnostics.getFinalMessage();
Collection<ContainerInformation> containerInfos = appDiagnostics.getContainers();
appStatusBuilder.setDiagnostics(finalMessage);
if (containerInfos != null) {
for (ContainerInformation containerInformation : containerInfos) {
if (containerInformation.getState() == StateValues.STATE_LIVE && !appComplete) {
LlapInstance instance = appStatusBuilder.removeAndGetCompletedLlapInstanceForContainer(containerInformation.getContainerId());
if (instance == null) {
// New launch. Not available during slider status, but available now.
instance = new LlapInstance(containerInformation.getHost(), containerInformation.getContainerId());
}
instance.setLogUrl(containerInformation.getLogLink());
appStatusBuilder.addNewRunningLlapInstance(instance);
} else if (containerInformation.getState() == StateValues.STATE_STOPPED || appComplete) {
LlapInstance instance = new LlapInstance(containerInformation.getHost(), containerInformation.getContainerId());
instance.setLogUrl(containerInformation.getLogLink());
if (appComplete && containerInformation.getExitCode() != ContainerExitStatus.INVALID) {
instance.setYarnContainerExitStatus(containerInformation.getExitCode());
}
instance.setDiagnostics(containerInformation.getDiagnostics());
appStatusBuilder.addNewCompleteLlapInstance(instance);
} else {
LOG.warn("Unexpected containerstate={}, for container={}", containerInformation.getState(), containerInformation);
}
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("ContainerInfos is null");
}
}
}
Aggregations