public List<LogAggregationReport> pullCachedLogAggregationReports() { List<LogAggregationReport> reports = new ArrayList<>(); if (disabled) { LOG.warn("The log aggregation is disabled." + "There is no cached log aggregation status."); return reports; } // When we pull cached Log aggregation reports for all application in // this NM, we should make sure that we need to block all of the // updateLogAggregationStatus calls. So, the writeLocker is used here. this.writeLocker.lock(); try { for(Entry<ApplicationId, AppLogAggregationStatusForRMRecovery> tracker : recoveryStatuses.entrySet()) { AppLogAggregationStatusForRMRecovery current = tracker.getValue(); LogAggregationReport report = LogAggregationReport.newInstance( tracker.getKey(), current.getLogAggregationStatus(), current.getDiagnosis()); reports.add(report); } return reports; } finally { this.writeLocker.unlock(); } }
public void transition(RMAppImpl app, RMAppEvent event) { RMAppRunningOnNodeEvent nodeAddedEvent = (RMAppRunningOnNodeEvent) event; // if final state already stored, notify RMNode if (isAppInFinalState(app)) { app.handler.handle( new RMNodeCleanAppEvent(nodeAddedEvent.getNodeId(), nodeAddedEvent .getApplicationId())); return; } // otherwise, add it to ranNodes for further process app.ranNodes.add(nodeAddedEvent.getNodeId()); if (!app.logAggregationStatus.containsKey(nodeAddedEvent.getNodeId())) { app.logAggregationStatus.put(nodeAddedEvent.getNodeId(), LogAggregationReport.newInstance(app.applicationId, app.logAggregationEnabled ? LogAggregationStatus.NOT_START : LogAggregationStatus.DISABLED, "")); } }; }
rmApp.aggregateLogReport(nodeId1, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.NOT_START, "")); rmApp.aggregateLogReport(nodeId2, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.NOT_START, "")); rmApp.aggregateLogReport(nodeId3, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.NOT_START, "")); rmApp.aggregateLogReport(nodeId4, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.NOT_START, "")); Assert.assertEquals(LogAggregationStatus.NOT_START, rmApp.getLogAggregationStatusForAppReport()); rmApp.aggregateLogReport(nodeId1, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.NOT_START, "")); rmApp.aggregateLogReport(nodeId2, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.RUNNING, "")); rmApp.aggregateLogReport(nodeId3, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.SUCCEEDED, "")); rmApp.aggregateLogReport(nodeId4, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.SUCCEEDED, "")); Assert.assertEquals(LogAggregationStatus.RUNNING, rmApp.aggregateLogReport(nodeId1, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.SUCCEEDED, "")); rmApp.aggregateLogReport(nodeId2, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.TIME_OUT, "")); rmApp.aggregateLogReport(nodeId3, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.SUCCEEDED, "")); rmApp.aggregateLogReport(nodeId4, LogAggregationReport.newInstance( rmApp.getApplicationId(), LogAggregationStatus.SUCCEEDED, ""));
"node1 logAggregation status updated at " + System.currentTimeMillis(); LogAggregationReport report1 = LogAggregationReport.newInstance(appId, LogAggregationStatus.RUNNING, messageForNode1_1); node1ReportForApp.add(report1); "node2 logAggregation status updated at " + System.currentTimeMillis(); LogAggregationReport report2 = LogAggregationReport.newInstance(appId, LogAggregationStatus.RUNNING, messageForNode2_1); node2ReportForApp.add(report2); "node1 logAggregation status updated at " + System.currentTimeMillis(); LogAggregationReport report1_2 = LogAggregationReport.newInstance(appId, LogAggregationStatus.RUNNING, messageForNode1_2); node1ReportForApp2.add(report1_2); for (int i = 0; i < 10 ; i ++) { report1_3 = LogAggregationReport.newInstance(appId, LogAggregationStatus.RUNNING, "test_message_" + i); node1ReportForApp3.add(report1_3); node1ReportForApp3.add(LogAggregationReport.newInstance(appId, LogAggregationStatus.SUCCEEDED, "")); new ArrayList<LogAggregationReport>(); LogAggregationReport report2_2 =