Java Code Examples for org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport#setNumUsedContainers()

The following examples show how to use org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport#setNumUsedContainers() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuilderUtils.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public static ApplicationResourceUsageReport newApplicationResourceUsageReport(
    int numUsedContainers, int numReservedContainers, Resource usedResources,
    Resource reservedResources, Resource neededResources, long memorySeconds, 
    long vcoreSeconds, long gcoreSeconds) {
  ApplicationResourceUsageReport report =
      recordFactory.newRecordInstance(ApplicationResourceUsageReport.class);
  report.setNumUsedContainers(numUsedContainers);
  report.setNumReservedContainers(numReservedContainers);
  report.setUsedResources(usedResources);
  report.setReservedResources(reservedResources);
  report.setNeededResources(neededResources);
  report.setMemorySeconds(memorySeconds);
  report.setVcoreSeconds(vcoreSeconds);
  report.setGcoreSeconds(gcoreSeconds);
  return report;
}
 
Example 2
Source File: TestTypeConverter.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test
public void testFromYarn() throws Exception {
  int appStartTime = 612354;
  int appFinishTime = 612355;
  YarnApplicationState state = YarnApplicationState.RUNNING;
  ApplicationId applicationId = ApplicationId.newInstance(0, 0);
  ApplicationReport applicationReport = Records
      .newRecord(ApplicationReport.class);
  applicationReport.setApplicationId(applicationId);
  applicationReport.setYarnApplicationState(state);
  applicationReport.setStartTime(appStartTime);
  applicationReport.setFinishTime(appFinishTime);
  applicationReport.setUser("TestTypeConverter-user");
  ApplicationResourceUsageReport appUsageRpt = Records
      .newRecord(ApplicationResourceUsageReport.class);
  Resource r = Records.newRecord(Resource.class);
  r.setMemory(2048);
  appUsageRpt.setNeededResources(r);
  appUsageRpt.setNumReservedContainers(1);
  appUsageRpt.setNumUsedContainers(3);
  appUsageRpt.setReservedResources(r);
  appUsageRpt.setUsedResources(r);
  applicationReport.setApplicationResourceUsageReport(appUsageRpt);
  JobStatus jobStatus = TypeConverter.fromYarn(applicationReport, "dummy-jobfile");
  Assert.assertEquals(appStartTime, jobStatus.getStartTime());
  Assert.assertEquals(appFinishTime, jobStatus.getFinishTime());    
  Assert.assertEquals(state.toString(), jobStatus.getState().toString());
}
 
Example 3
Source File: BuilderUtils.java    From big-c with Apache License 2.0 5 votes vote down vote up
public static ApplicationResourceUsageReport newApplicationResourceUsageReport(
    int numUsedContainers, int numReservedContainers, Resource usedResources,
    Resource reservedResources, Resource neededResources, long memorySeconds, 
    long vcoreSeconds) {
  ApplicationResourceUsageReport report =
      recordFactory.newRecordInstance(ApplicationResourceUsageReport.class);
  report.setNumUsedContainers(numUsedContainers);
  report.setNumReservedContainers(numReservedContainers);
  report.setUsedResources(usedResources);
  report.setReservedResources(reservedResources);
  report.setNeededResources(neededResources);
  report.setMemorySeconds(memorySeconds);
  report.setVcoreSeconds(vcoreSeconds);
  return report;
}
 
Example 4
Source File: TestTypeConverter.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testFromYarn() throws Exception {
  int appStartTime = 612354;
  int appFinishTime = 612355;
  YarnApplicationState state = YarnApplicationState.RUNNING;
  ApplicationId applicationId = ApplicationId.newInstance(0, 0);
  ApplicationReport applicationReport = Records
      .newRecord(ApplicationReport.class);
  applicationReport.setApplicationId(applicationId);
  applicationReport.setYarnApplicationState(state);
  applicationReport.setStartTime(appStartTime);
  applicationReport.setFinishTime(appFinishTime);
  applicationReport.setUser("TestTypeConverter-user");
  ApplicationResourceUsageReport appUsageRpt = Records
      .newRecord(ApplicationResourceUsageReport.class);
  Resource r = Records.newRecord(Resource.class);
  r.setMemory(2048);
  appUsageRpt.setNeededResources(r);
  appUsageRpt.setNumReservedContainers(1);
  appUsageRpt.setNumUsedContainers(3);
  appUsageRpt.setReservedResources(r);
  appUsageRpt.setUsedResources(r);
  applicationReport.setApplicationResourceUsageReport(appUsageRpt);
  JobStatus jobStatus = TypeConverter.fromYarn(applicationReport, "dummy-jobfile");
  Assert.assertEquals(appStartTime, jobStatus.getStartTime());
  Assert.assertEquals(appFinishTime, jobStatus.getFinishTime());    
  Assert.assertEquals(state.toString(), jobStatus.getState().toString());
}