.append(app.getStartTime()).append("\",\"") .append(app.getFinishTime()).append("\",\"") .append(app.getState()).append("\",\"") .append(app.getFinalStatus()).append("\",\"")
.append(appInfo.getStartTime()).append("\",\"") .append(appInfo.getFinishTime()).append("\",\"") .append(appInfo.getState()).append("\",\"") .append(appInfo.getFinalStatus()).append("\",\"")
.append(appInfo.getStartTime()).append("\",\"") .append(appInfo.getFinishTime()).append("\",\"") .append(appInfo.getState()).append("\",\"") .append(appInfo.getFinalStatus()).append("\",\"")
.append(appInfo.getLaunchTime()).append("\",\"") .append(appInfo.getFinishTime()).append("\",\"") .append(appInfo.getState()).append("\",\"") .append(appInfo.getFinalStatus()).append("\",\"") .append(appInfo.getRunningContainers() == -1 ? "N/A" : String
private static AppInfo mergeUAMWithUAM(AppInfo uam1, AppInfo uam2) { AppInfo partialReport = new AppInfo(); partialReport.setAppId(uam1.getAppId()); partialReport.setName(PARTIAL_REPORT + uam1.getAppId()); // We pick the status of the first uam partialReport.setState(uam1.getState()); // Merge the newly partial AM with UAM1 and then with UAM2 mergeAMWithUAM(partialReport, uam1); mergeAMWithUAM(partialReport, uam2); return partialReport; }
private static void mergeAMWithUAM(AppInfo am, AppInfo uam) { am.setPreemptedResourceMB( am.getPreemptedResourceMB() + uam.getPreemptedResourceMB()); am.setPreemptedResourceVCores( am.getPreemptedResourceVCores() + uam.getPreemptedResourceVCores()); am.setNumNonAMContainerPreempted(am.getNumNonAMContainerPreempted() + uam.getNumNonAMContainerPreempted()); am.setNumAMContainerPreempted( am.getNumAMContainerPreempted() + uam.getNumAMContainerPreempted()); am.setPreemptedMemorySeconds( am.getPreemptedMemorySeconds() + uam.getPreemptedMemorySeconds()); am.setPreemptedVcoreSeconds( am.getPreemptedVcoreSeconds() + uam.getPreemptedVcoreSeconds()); if (am.getState() == YarnApplicationState.RUNNING && uam.getState() == am.getState()) { am.getResourceRequests().addAll(uam.getResourceRequests()); am.setAllocatedMB(am.getAllocatedMB() + uam.getAllocatedMB()); am.setAllocatedVCores(am.getAllocatedVCores() + uam.getAllocatedVCores()); am.setReservedMB(am.getReservedMB() + uam.getReservedMB()); am.setReservedVCores(am.getReservedVCores() + uam.getReservedMB()); am.setRunningContainers( am.getRunningContainers() + uam.getRunningContainers()); am.setMemorySeconds(am.getMemorySeconds() + uam.getMemorySeconds()); am.setVcoreSeconds(am.getVcoreSeconds() + uam.getVcoreSeconds()); } }
@Test public void testUnmarshalAppInfo() throws JSONException, Exception { rm.start(); MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048); RMApp app1 = rm.submitApp(CONTAINER_MB, "testwordcount", "user1"); amNodeManager.nodeHeartbeat(true); WebResource r = resource(); ClientResponse response = r.path("ws").path("v1").path("cluster") .path("apps").path(app1.getApplicationId().toString()) .accept(MediaType.APPLICATION_XML).get(ClientResponse.class); AppInfo appInfo = response.getEntity(AppInfo.class); // Check only a few values; all are validated in testSingleApp. assertEquals(app1.getApplicationId().toString(), appInfo.getAppId()); assertEquals(app1.getName(), appInfo.getName()); assertEquals(app1.createApplicationState(), appInfo.getState()); assertEquals(app1.getAMResourceRequests().get(0).getCapability() .getMemorySize(), appInfo.getAllocatedMB()); rm.stop(); }