org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler.getAppResourceUsageReport()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler.getAppResourceUsageReport()方法的一些代码示例,展示了YarnScheduler.getAppResourceUsageReport()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnScheduler.getAppResourceUsageReport()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler
类名称:YarnScheduler
方法名:getAppResourceUsageReport

YarnScheduler.getAppResourceUsageReport介绍

[英]Get a resource usage report from a given app attempt ID.
[中]从给定的应用尝试ID获取资源使用情况报告。

代码示例

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@Override
public ApplicationResourceUsageReport getApplicationResourceUsageReport() {
 this.readLock.lock();
 try {
  ApplicationResourceUsageReport report =
    scheduler.getAppResourceUsageReport(this.getAppAttemptId());
  if (report == null) {
   report = RMServerUtils.DUMMY_APPLICATION_RESOURCE_USAGE_REPORT;
  }
  AggregateAppResourceUsage resUsage =
    this.attemptMetrics.getAggregateAppResourceUsage();
  report.setMemorySeconds(resUsage.getMemorySeconds());
  report.setVcoreSeconds(resUsage.getVcoreSeconds());
  return report;
 } finally {
  this.readLock.unlock();
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
public ApplicationResourceUsageReport getApplicationResourceUsageReport() {
 this.readLock.lock();
 try {
  ApplicationResourceUsageReport report =
    scheduler.getAppResourceUsageReport(this.getAppAttemptId());
  if (report == null) {
   report = RMServerUtils.DUMMY_APPLICATION_RESOURCE_USAGE_REPORT;
  }
  AggregateAppResourceUsage resUsage =
    this.attemptMetrics.getAggregateAppResourceUsage();
  report.setMemorySeconds(resUsage.getMemorySeconds());
  report.setVcoreSeconds(resUsage.getVcoreSeconds());
  return report;
 } finally {
  this.readLock.unlock();
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
public ApplicationResourceUsageReport getApplicationResourceUsageReport() {
 this.readLock.lock();
 try {
  ApplicationResourceUsageReport report =
    scheduler.getAppResourceUsageReport(this.getAppAttemptId());
  if (report == null) {
   report = RMServerUtils.DUMMY_APPLICATION_RESOURCE_USAGE_REPORT;
  }
  AggregateAppResourceUsage resUsage =
    this.attemptMetrics.getAggregateAppResourceUsage();
  report.setResourceSecondsMap(resUsage.getResourceUsageSecondsMap());
  report.setPreemptedResourceSecondsMap(
    this.attemptMetrics.getPreemptedResourceSecondsMap());
  return report;
 } finally {
  this.readLock.unlock();
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

private static YarnScheduler mockYarnScheduler() {
 YarnScheduler yarnScheduler = mock(YarnScheduler.class);
 when(yarnScheduler.getMinimumResourceCapability()).thenReturn(
   Resources.createResource(
     YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB));
 when(yarnScheduler.getMaximumResourceCapability()).thenReturn(
   Resources.createResource(
     YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB));
 when(yarnScheduler.getAppsInQueue(QUEUE_1)).thenReturn(
   Arrays.asList(getApplicationAttemptId(101), getApplicationAttemptId(102)));
 when(yarnScheduler.getAppsInQueue(QUEUE_2)).thenReturn(
   Arrays.asList(getApplicationAttemptId(103)));
 ApplicationAttemptId attemptId = getApplicationAttemptId(1);
 when(yarnScheduler.getAppResourceUsageReport(attemptId)).thenReturn(null);
 ResourceCalculator rc = new DefaultResourceCalculator();
 when(yarnScheduler.getResourceCalculator()).thenReturn(rc);
 return yarnScheduler;
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

when(appResUsgRpt.getMemorySeconds()).thenReturn(123456L);
when(appResUsgRpt.getVcoreSeconds()).thenReturn(55544L);
when(scheduler.getAppResourceUsageReport(any(ApplicationAttemptId.class)))
.thenReturn(appResUsgRpt);

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

when(appResUsgRpt.getMemorySeconds()).thenReturn(123456L);
when(appResUsgRpt.getVcoreSeconds()).thenReturn(55544L);
when(scheduler.getAppResourceUsageReport(any(ApplicationAttemptId.class)))
.thenReturn(appResUsgRpt);

相关文章