org.apache.hadoop.yarn.util.resource.Resources.none()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(165)

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

Resources.none介绍

暂无

代码示例

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

/**
 * Reset the minshare starvation attributed to this application. To be
 * called only from {@link FSLeafQueue#updateStarvedApps}
 */
void resetMinshareStarvation() {
 this.minshareStarvation = Resources.none();
}

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

private static Resource normalize(Resource res) {
 if (res == null) {
  return Resources.none();
 }
 return res;
}

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

public Resource getBlockedHeadroom() {
 if (blockedHeadroom == null) {
  return Resources.none();
 }
 return blockedHeadroom;
}

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

private static Resource normalize(Resource res) {
 if (res == null) {
  return Resources.none();
 }
 return res;
}

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

private static Resource normalize(Resource res) {
 if (res == null) {
  return Resources.none();
 }
 return res;
}

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

/**
 * Get the minimum resource allocation for the given queue.
 * @return the cap set on this queue, or 0 if not set.
 */
public Resource getMinResources(String queue) {
 Resource minQueueResource = minQueueResources.get(queue);
 return (minQueueResource == null) ? Resources.none() : minQueueResource;
}

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

/**
 * Get the minimum resource allocation for the given queue.
 * @return the cap set on this queue, or 0 if not set.
 */
public Resource getMinResources(String queue) {
 Resource minQueueResource = minQueueResources.get(queue);
 return (minQueueResource == null) ? Resources.none() : minQueueResource;
}

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

/**
 * Get the minimum resource allocation for the given queue.
 *
 * @param queue the target queue's name
 * @return the min allocation on this queue or {@link Resources#none}
 * if not set
 */
@VisibleForTesting
Resource getMinResources(String queue) {
 Resource minQueueResource = minQueueResources.get(queue);
 return (minQueueResource == null) ? Resources.none() : minQueueResource;
}

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

private Resource _get(String label, ResourceType type) {
 try {
  readLock.lock();
  UsageByLabel usage = usages.get(label);
  if (null == usage) {
   return Resources.none();
  }
  return normalize(usage.resArr[type.idx]);
 } finally {
  readLock.unlock();
 }
}

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

private Resource _get(String label, ResourceType type) {
 try {
  readLock.lock();
  UsageByLabel usage = usages.get(label);
  if (null == usage) {
   return Resources.none();
  }
  return normalize(usage.resArr[type.idx]);
 } finally {
  readLock.unlock();
 }
}

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

public Resource getResourceByLabel(String label, Resource clusterResource) {
 label = normalizeLabel(label);
 try {
  readLock.lock();
  if (null == labelCollections.get(label)) {
   return Resources.none();
  }
  return labelCollections.get(label).getResource();
 } finally {
  readLock.unlock();
 }
}

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

private double getIdealPctOfGuaranteed(TempQueue q) {
  double pctOver = Integer.MAX_VALUE;
  if (q != null && Resources.greaterThan(
    rc, clusterRes, q.guaranteed, Resources.none())) {
   pctOver =
     Resources.divide(rc, clusterRes, q.idealAssigned, q.guaranteed);
  }
  return (pctOver);
 }
}

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

private double getIdealPctOfGuaranteed(TempQueuePerPartition q) {
  double pctOver = Integer.MAX_VALUE;
  if (q != null && Resources.greaterThan(rc, clusterRes, q.getGuaranteed(),
    Resources.none())) {
   pctOver = Resources.divide(rc, clusterRes, q.idealAssigned,
     q.getGuaranteed());
  }
  return (pctOver);
 }
}

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

private void finalValidation(FSSchedulerNode schedulerNode) {
 assertEquals("Everything should have been released",
   Resources.none(), schedulerNode.getAllocatedResource());
 assertTrue("No containers should be reserved for preemption",
   schedulerNode.containersForPreemption.isEmpty());
 assertTrue("No resources should be reserved for preemptors",
   schedulerNode.resourcesPreemptedForApp.isEmpty());
 assertEquals(
   "No amount of resource should be reserved for preemptees",
   Resources.none(),
   schedulerNode.getTotalReserved());
}

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

public void deductActuallyToBePreempted(ResourceCalculator rc,
  Resource cluster, Resource toBeDeduct) {
 if (Resources.greaterThan(rc, cluster, getActuallyToBePreempted(),
   toBeDeduct)) {
  Resources.subtractFrom(getActuallyToBePreempted(), toBeDeduct);
 }
 setActuallyToBePreempted(Resources.max(rc, cluster,
   getActuallyToBePreempted(), Resources.none()));
}

代码示例来源:origin: io.hops/hadoop-yarn-common

@Test(timeout=10000)
 public void testCompareToWithNoneResource() {
  assertTrue(Resources.none().compareTo(createResource(0, 0, 0)) == 0);
  assertTrue(Resources.none().compareTo(
    createResource(1, 0, 0)) < 0);
  assertTrue(Resources.none().compareTo(
    createResource(0, 1, 0)) < 0);
  assertTrue(Resources.none().compareTo(
    createResource(0, 0, 1)) < 0);
 }
}

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

private Schedulable createSchedulable(int memUsage, int cpuUsage,
  float weights, int minMemShare, int minCpuShare) {
 Resource usage = BuilderUtils.newResource(memUsage, cpuUsage);
 Resource minShare = BuilderUtils.newResource(minMemShare, minCpuShare);
 return new FakeSchedulable(minShare,
   Resources.createResource(Integer.MAX_VALUE, Integer.MAX_VALUE),
   weights, Resources.none(), usage, 0l);
}

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

@Test
public void testApplicationSubmissionContextPBImpl() throws Exception {
 validatePBImplRecord(ApplicationSubmissionContextPBImpl.class,
   ApplicationSubmissionContextProto.class);
 
 ApplicationSubmissionContext ctx =
   ApplicationSubmissionContext.newInstance(null, null, null, null, null,
     false, false, 0, Resources.none(), null, false, null, null);
 
 Assert.assertNotNull(ctx.getResource());
}

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

@Test
public void testApplicationSubmissionContextPBImpl() throws Exception {
 validatePBImplRecord(ApplicationSubmissionContextPBImpl.class,
   ApplicationSubmissionContextProto.class);
 
 ApplicationSubmissionContext ctx =
   ApplicationSubmissionContext.newInstance(null, null, null, null, null,
     false, false, 0, Resources.none(), null, false, null, null);
 
 Assert.assertNotNull(ctx.getResource());
}

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

private void verifyContainerAllocated(CSAssignment assignment, NodeType nodeType) {
 Assert.assertTrue(Resources.greaterThan(resourceCalculator, null,
   assignment.getResource(), Resources.none()));
 Assert
   .assertTrue(assignment.getAssignmentInformation().getNumAllocations() > 0);
 Assert.assertEquals(nodeType, assignment.getType());
}

相关文章