当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationResourceUsageReport.setNeededResources方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport.setNeededResources方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationResourceUsageReport.setNeededResources方法的具体用法?Java ApplicationResourceUsageReport.setNeededResources怎么用?Java ApplicationResourceUsageReport.setNeededResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport的用法示例。


在下文中一共展示了ApplicationResourceUsageReport.setNeededResources方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newApplicationResourceUsageReport

import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; //导入方法依赖的package包/类
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;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:BuilderUtils.java

示例2: testFromYarn

import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; //导入方法依赖的package包/类
@Test
public void testFromYarn() throws Exception {
  int appStartTime = 612354;
  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.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(state.toString(), jobStatus.getState().toString());
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:TestTypeConverter.java

示例3: newApplicationResourceUsageReport

import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; //导入方法依赖的package包/类
public static ApplicationResourceUsageReport newApplicationResourceUsageReport(
     int numUsedContainers, int numReservedContainers, Resource usedResources,
     Resource reservedResources, Resource neededResources, long memorySeconds, 
     long vcoreSeconds, long gpuSeconds, long preemptedMemorySeconds,
     long preemptedVcoreSeconds, long preemptedGPUSeconds) {
   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.setGPUSeconds(gpuSeconds);
   report.setPreemptedMemorySeconds(preemptedMemorySeconds);
   report.setPreemptedVcoreSeconds(preemptedVcoreSeconds);
report.setPreemptedGPUSeconds(preemptedGPUSeconds);
   return report;
 }
 
开发者ID:hopshadoop,项目名称:hops,代码行数:21,代码来源:BuilderUtils.java

示例4: testFromYarn

import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; //导入方法依赖的package包/类
@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());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestTypeConverter.java

示例5: newApplicationResourceUsageReport

import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; //导入方法依赖的package包/类
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;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:16,代码来源:BuilderUtils.java

示例6: testFromYarn

import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; //导入方法依赖的package包/类
@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");
  applicationReport.setPriority(Priority.newInstance(3));
  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());
  Assert.assertEquals(JobPriority.NORMAL, jobStatus.getPriority());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:31,代码来源:TestTypeConverter.java

示例7: newApplicationResourceUsageReport

import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; //导入方法依赖的package包/类
public static ApplicationResourceUsageReport newApplicationResourceUsageReport(
    int numUsedContainers, int numReservedContainers, Resource usedResources,
    Resource reservedResources, Resource neededResources) {
  ApplicationResourceUsageReport report =
      recordFactory.newRecordInstance(ApplicationResourceUsageReport.class);
  report.setNumUsedContainers(numUsedContainers);
  report.setNumReservedContainers(numReservedContainers);
  report.setUsedResources(usedResources);
  report.setReservedResources(reservedResources);
  report.setNeededResources(neededResources);
  return report;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:13,代码来源:BuilderUtils.java

示例8: testFromYarnApplicationReport

import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; //导入方法依赖的package包/类
@Test
public void testFromYarnApplicationReport() {
  ApplicationId mockAppId = mock(ApplicationId.class);
  when(mockAppId.getClusterTimestamp()).thenReturn(12345L);
  when(mockAppId.getId()).thenReturn(6789);

  ApplicationReport mockReport = mock(ApplicationReport.class);
  when(mockReport.getTrackingUrl()).thenReturn("dummy-tracking-url");
  when(mockReport.getApplicationId()).thenReturn(mockAppId);
  when(mockReport.getYarnApplicationState()).thenReturn(YarnApplicationState.KILLED);
  when(mockReport.getUser()).thenReturn("dummy-user");
  when(mockReport.getQueue()).thenReturn("dummy-queue");
  String jobFile = "dummy-path/job.xml";
  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);
  when(mockReport.getApplicationResourceUsageReport()).thenReturn(appUsageRpt);
  JobStatus status = TypeConverter.fromYarn(mockReport, jobFile);
  Assert.assertNotNull("fromYarn returned null status", status);
  Assert.assertEquals("jobFile set incorrectly", "dummy-path/job.xml", status.getJobFile());
  Assert.assertEquals("queue set incorrectly", "dummy-queue", status.getQueue());
  Assert.assertEquals("trackingUrl set incorrectly", "dummy-tracking-url", status.getTrackingUrl());
  Assert.assertEquals("user set incorrectly", "dummy-user", status.getUsername());
  Assert.assertEquals("schedulingInfo set incorrectly", "dummy-tracking-url", status.getSchedulingInfo());
  Assert.assertEquals("jobId set incorrectly", 6789, status.getJobID().getId());
  Assert.assertEquals("state set incorrectly", JobStatus.State.KILLED, status.getState());
  Assert.assertEquals("needed mem info set incorrectly", 2048, status.getNeededMem());
  Assert.assertEquals("num rsvd slots info set incorrectly", 1, status.getNumReservedSlots());
  Assert.assertEquals("num used slots info set incorrectly", 3, status.getNumUsedSlots());
  Assert.assertEquals("rsvd mem info set incorrectly", 2048, status.getReservedMem());
  Assert.assertEquals("used mem info set incorrectly", 2048, status.getUsedMem());
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:39,代码来源:TestTypeConverter.java

示例9: testFromYarn

import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; //导入方法依赖的package包/类
@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");
  applicationReport.setPriority(Priority.newInstance(3));
  ApplicationResourceUsageReport appUsageRpt = Records
      .newRecord(ApplicationResourceUsageReport.class);
  Resource r = Records.newRecord(Resource.class);
  r.setMemorySize(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());
  Assert.assertEquals(JobPriority.NORMAL, jobStatus.getPriority());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:31,代码来源:TestTypeConverter.java


注:本文中的org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport.setNeededResources方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。