return true;
}
Long requestId = apiRequestSummary.getApiRequestInfo().getRequestId();
ApiRequest apiRequest = apiManager.getRequestWithTasks(clusterName, requestId);
ClusterRequestStatus clusterRequestStatus =
ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo()
.getRequestStatus());
Map<String, NodeReport> nodeReports = currentReport.getNodeReports();
for (String nodeReportKey : nodeReports.keySet()) {
for (ApiTask apiTask : apiRequest.getApiTasks()) {
NodeReport nodeReport = nodeReports.get(nodeReportKey);
nodeReport.setUseClusterMsg(false);
ApiTaskInfo apiTaskInfo = apiTask.getApiTaskInfo();
if (nodeReport.getHostname().equals(apiTaskInfo.getHostName())) {
TaskStatus taskStatus =
TaskStatus.valueOf(apiTask.getApiTaskInfo().getStatus());
if (taskStatus.isRunningState()) {
if (clusterRequestStatus.isFailedState() &&
apiTaskInfo.getStderr() != null &&
!apiTaskInfo.getStderr().isEmpty()) {
nodeReport.setAction(apiTaskInfo.getCommandDetail() + ": "
+ apiTaskInfo.getStderr());
} else {
nodeReport.setAction(apiTaskInfo.getCommandDetail());
}
nodeReports.put(nodeReportKey, nodeReport);
}
}
}
}
currentReport.setNodeReports(nodeReports);
int provisionPercent =
(int) apiRequest.getApiRequestInfo().getProgressPercent();
if (provisionPercent != 0) {
int currentProgress = currentReport.getProgress();
int toProgress = beginProgress + provisionPercent / 2;
if (toProgress >= endProgress) {
toProgress = endProgress;
}
boolean isCompletedState = clusterRequestStatus.isCompletedState();
if ((toProgress != currentProgress) && (provisionPercent % 10 == 0)
|| isCompletedState) {
if (isCompletedState) {
logger.info("Cluster request " + requestId + " is completed.");
} else {
logger.info("Waiting for cluster request " + requestId
+ " to complete.");
}
currentReport.setProgress(toProgress);
if (reportQueue != null) {
reportQueue.addClusterReport(currentReport.clone());
}
}
}
if (clusterRequestStatus.isCompletedState()) {
return true;
}
return false;
}