@Override public int getNeededMem() { return report.getApplicationResourceUsageReport(). getNeededResources().getMemory(); }
/** * Display a formatted summary of the job progress report from the AM. * * @param report * the report to display. */ private void displayJobReport(final ApplicationReport report) { if(null == report) { throw new IllegalStateException(String.format( "[*] Latest ApplicationReport for job %s was not received by the local client.", getAppName())); } final float elapsed = (System.currentTimeMillis() - report.getStartTime()) / 1000.0f; LOG.info("{}, Elapsed: {}", getAppName(), String.format("%.2f secs", elapsed)); LOG.info("{}, State: {} , Containers: used/reserved/needed-resources {}/{}/{}", report .getCurrentApplicationAttemptId(), report.getYarnApplicationState().name(), report .getApplicationResourceUsageReport().getNumUsedContainers(), report.getApplicationResourceUsageReport() .getNumReservedContainers(), report.getApplicationResourceUsageReport().getNeededResources()); }
/** * Display a formatted summary of the job progress report from the AM. * * @param report * the report to display. */ private void displayJobReport(final ApplicationReport report) { if(null == report) { throw new IllegalStateException(String.format( "[*] Latest ApplicationReport for job %s was not received by the local client.", getAppName())); } final float elapsed = (System.currentTimeMillis() - report.getStartTime()) / 1000.0f; LOG.info("{}, Elapsed: {}", getAppName(), String.format("%.2f secs", elapsed)); LOG.info("{}, State: {} , Containers: used/reserved/needed-resources {}/{}/{}", report .getCurrentApplicationAttemptId(), report.getYarnApplicationState().name(), report .getApplicationResourceUsageReport().getNumUsedContainers(), report.getApplicationResourceUsageReport() .getNumReservedContainers(), report.getApplicationResourceUsageReport().getNeededResources()); }
private ApplicationReport getApplicationReport( YarnApplicationState yarnApplicationState, FinalApplicationStatus finalApplicationStatus) { ApplicationReport appReport = Mockito.mock(ApplicationReport.class); ApplicationResourceUsageReport appResources = Mockito .mock(ApplicationResourceUsageReport.class); Mockito.when(appReport.getApplicationId()).thenReturn( ApplicationId.newInstance(0, 0)); Mockito.when(appResources.getNeededResources()).thenReturn( Records.newRecord(Resource.class)); Mockito.when(appResources.getReservedResources()).thenReturn( Records.newRecord(Resource.class)); Mockito.when(appResources.getUsedResources()).thenReturn( Records.newRecord(Resource.class)); Mockito.when(appReport.getApplicationResourceUsageReport()).thenReturn( appResources); Mockito.when(appReport.getYarnApplicationState()).thenReturn( yarnApplicationState); Mockito.when(appReport.getFinalApplicationStatus()).thenReturn( finalApplicationStatus); return appReport; } }
int thisMemory = report.getApplicationResourceUsageReport().getNeededResources().getMemory(); int thisCores = report.getApplicationResourceUsageReport().getNeededResources().getVirtualCores(); if(thisMemory > maxMemory || thisMemory == maxMemory && thisCores > maxCores) { maxMemory = thisMemory;
int thisMemory = report.getApplicationResourceUsageReport().getNeededResources().getMemory(); int thisCores = report.getApplicationResourceUsageReport().getNeededResources().getVirtualCores(); if(thisMemory > maxMemory || thisMemory == maxMemory && thisCores > maxCores) { maxMemory = thisMemory;
if (resourceUsageReport != null) { jobStatus.setNeededMem( resourceUsageReport.getNeededResources().getMemory()); jobStatus.setNumReservedSlots( resourceUsageReport.getNumReservedContainers());
if (resourceUsageReport != null) { jobStatus.setNeededMem( resourceUsageReport.getNeededResources().getMemory()); jobStatus.setNumReservedSlots( resourceUsageReport.getNumReservedContainers());
if (resourceUsageReport != null) { jobStatus.setNeededMem( (int)resourceUsageReport.getNeededResources().getMemorySize()); jobStatus.setNumReservedSlots( resourceUsageReport.getNumReservedContainers());
if (resourceUsageReport != null) { jobStatus.setNeededMem( (int)resourceUsageReport.getNeededResources().getMemorySize()); jobStatus.setNumReservedSlots( resourceUsageReport.getNumReservedContainers());
private void verifyEnemyAppReport(ApplicationReport appReport) { Assert.assertEquals("Enemy should not see app host!", UNAVAILABLE, appReport.getHost()); Assert.assertEquals("Enemy should not see app rpc port!", -1, appReport.getRpcPort()); Assert.assertEquals("Enemy should not see app client token!", null, appReport.getClientToAMToken()); Assert.assertEquals("Enemy should not see app diagnostics!", UNAVAILABLE, appReport.getDiagnostics()); Assert.assertEquals("Enemy should not see app tracking url!", UNAVAILABLE, appReport.getTrackingUrl()); Assert.assertEquals("Enemy should not see app original tracking url!", UNAVAILABLE, appReport.getOriginalTrackingUrl()); ApplicationResourceUsageReport usageReport = appReport.getApplicationResourceUsageReport(); Assert.assertEquals("Enemy should not see app used containers", -1, usageReport.getNumUsedContainers()); Assert.assertEquals("Enemy should not see app reserved containers", -1, usageReport.getNumReservedContainers()); Assert.assertEquals("Enemy should not see app used resources", -1, usageReport.getUsedResources().getMemory()); Assert.assertEquals("Enemy should not see app reserved resources", -1, usageReport.getReservedResources().getMemory()); Assert.assertEquals("Enemy should not see app needed resources", -1, usageReport.getNeededResources().getMemory()); }
private void verifyEnemyAppReport(ApplicationReport appReport) { Assert.assertEquals("Enemy should not see app host!", UNAVAILABLE, appReport.getHost()); Assert.assertEquals("Enemy should not see app rpc port!", -1, appReport.getRpcPort()); Assert.assertEquals("Enemy should not see app client token!", null, appReport.getClientToAMToken()); Assert.assertEquals("Enemy should not see app diagnostics!", UNAVAILABLE, appReport.getDiagnostics()); Assert.assertEquals("Enemy should not see app tracking url!", UNAVAILABLE, appReport.getTrackingUrl()); Assert.assertEquals("Enemy should not see app original tracking url!", UNAVAILABLE, appReport.getOriginalTrackingUrl()); ApplicationResourceUsageReport usageReport = appReport.getApplicationResourceUsageReport(); Assert.assertEquals("Enemy should not see app used containers", -1, usageReport.getNumUsedContainers()); Assert.assertEquals("Enemy should not see app reserved containers", -1, usageReport.getNumReservedContainers()); Assert.assertEquals("Enemy should not see app used resources", -1, usageReport.getUsedResources().getMemorySize()); Assert.assertEquals("Enemy should not see app reserved resources", -1, usageReport.getReservedResources().getMemorySize()); Assert.assertEquals("Enemy should not see app needed resources", -1, usageReport.getNeededResources().getMemorySize()); }