Search in sources :

Example 6 with LogAggregationStatus

use of org.apache.hadoop.yarn.api.records.LogAggregationStatus in project hadoop by apache.

the class RMAppImpl method updateLogAggregationStatus.

private void updateLogAggregationStatus(NodeId nodeId) {
    LogAggregationStatus status = this.logAggregationStatus.get(nodeId).getLogAggregationStatus();
    if (status.equals(LogAggregationStatus.SUCCEEDED)) {
        this.logAggregationSucceed++;
    } else if (status.equals(LogAggregationStatus.FAILED)) {
        this.logAggregationFailed++;
    }
    if (this.logAggregationSucceed == this.logAggregationStatus.size()) {
        this.logAggregationStatusForAppReport = LogAggregationStatus.SUCCEEDED;
        // Since the log aggregation status for this application for all NMs
        // is SUCCEEDED, it means all logs are aggregated successfully.
        // We could remove all the cached log aggregation reports
        this.logAggregationStatus.clear();
        this.logAggregationDiagnosticsForNMs.clear();
        this.logAggregationFailureMessagesForNMs.clear();
    } else if (this.logAggregationSucceed + this.logAggregationFailed == this.logAggregationStatus.size()) {
        this.logAggregationStatusForAppReport = LogAggregationStatus.FAILED;
        // the log aggregation details for those succeeded NMs
        for (Iterator<Map.Entry<NodeId, LogAggregationReport>> it = this.logAggregationStatus.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry<NodeId, LogAggregationReport> entry = it.next();
            if (entry.getValue().getLogAggregationStatus().equals(LogAggregationStatus.SUCCEEDED)) {
                it.remove();
            }
        }
        // the log aggregation has finished/failed.
        // and the status will not be updated anymore.
        this.logAggregationDiagnosticsForNMs.clear();
    }
}
Also used : Entry(java.util.Map.Entry) LogAggregationReport(org.apache.hadoop.yarn.server.api.protocolrecords.LogAggregationReport) Iterator(java.util.Iterator) NodeId(org.apache.hadoop.yarn.api.records.NodeId) LogAggregationStatus(org.apache.hadoop.yarn.api.records.LogAggregationStatus) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

LogAggregationStatus (org.apache.hadoop.yarn.api.records.LogAggregationStatus)6 ApplicationReport (org.apache.hadoop.yarn.api.records.ApplicationReport)2 NodeId (org.apache.hadoop.yarn.api.records.NodeId)2 LogAggregationReport (org.apache.hadoop.yarn.server.api.protocolrecords.LogAggregationReport)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 Path (org.apache.hadoop.fs.Path)1 UnsupportedFileSystemException (org.apache.hadoop.fs.UnsupportedFileSystemException)1 Credentials (org.apache.hadoop.security.Credentials)1 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)1 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)1 ApplicationResourceUsageReport (org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport)1 ApplicationTimeout (org.apache.hadoop.yarn.api.records.ApplicationTimeout)1