use of org.apache.flink.runtime.clusterframework.ApplicationStatus in project flink by apache.
the class YarnClusterClient method getApplicationStatus.
public ApplicationStatus getApplicationStatus() {
if (!isConnected) {
throw new IllegalStateException("The cluster has been connected to the ApplicationMaster.");
}
ApplicationReport lastReport = null;
if (pollingRunner == null) {
LOG.warn("YarnClusterClient.getApplicationStatus() has been called on an uninitialized cluster." + "The system might be in an erroneous state");
} else {
lastReport = pollingRunner.getLastReport();
}
if (lastReport == null) {
LOG.warn("YarnClusterClient.getApplicationStatus() has been called on a cluster that didn't receive a status so far." + "The system might be in an erroneous state");
return ApplicationStatus.UNKNOWN;
} else {
YarnApplicationState appState = lastReport.getYarnApplicationState();
ApplicationStatus status = (appState == YarnApplicationState.FAILED || appState == YarnApplicationState.KILLED) ? ApplicationStatus.FAILED : ApplicationStatus.SUCCEEDED;
if (status != ApplicationStatus.SUCCEEDED) {
LOG.warn("YARN reported application state {}", appState);
LOG.warn("Diagnostics: {}", lastReport.getDiagnostics());
}
return status;
}
}
Aggregations