@Override public long getResourceValue(String resource) { return super.getResourceValue(resource); }
/** * Get number of requested GPUs from resource. * @param requestedResource requested resource * @return #gpus. */ public static int getRequestedGpus(Resource requestedResource) { try { return Long.valueOf(requestedResource.getResourceValue( GPU_URI)).intValue(); } catch (ResourceNotFoundException e) { return 0; } }
/** * Compute the resources assigned to a Schedulable given a particular * weight-to-resource ratio w2rRatio. */ private static int computeShare(Schedulable sched, double w2rRatio, String type) { double share = sched.getWeight() * w2rRatio; share = Math.max(share, sched.getMinShare().getResourceValue(type)); share = Math.min(share, sched.getMaxShare().getResourceValue(type)); return (int) share; }
/** * Get the fairshare for the {@link Schedulable} if it is fixed, -1 otherwise. * * The fairshare is fixed if either the maxShare is 0, weight is 0, * or the Schedulable is not active for instantaneous fairshare. */ private static long getFairShareIfFixed(Schedulable sched, boolean isSteadyShare, String type) { // Check if maxShare is 0 if (sched.getMaxShare().getResourceValue(type) <= 0) { return 0; } // For instantaneous fairshares, check if queue is active if (!isSteadyShare && (sched instanceof FSQueue) && !((FSQueue)sched).isActive()) { return 0; } // Check if weight is 0 if (sched.getWeight() <= 0) { long minShare = sched.getMinShare().getResourceValue(type); return (minShare <= 0) ? 0 : minShare; } return -1; } }
long maxShare = sched.getMaxShare().getResourceValue(type); totalMaxShare = (int) Math.min(maxShare + (long)totalMaxShare, Integer.MAX_VALUE); long totalResource = Math.max((totalResources.getResourceValue(type) - takenResources), 0); totalResource = Math.min(totalMaxShare, totalResource);
containerIdStr); long deviceCount = requestedResource.getResourceValue(FPGA_URI); LOG.info(containerIdStr + " requested " + deviceCount + " Intel FPGA(s)"); String ipFilePath = null;
cs.getMaximumResourceCapability().getResourceValue(RESOURCE_1)); Assert.assertEquals(3333L, cs.getMaximumAllocation().getResourceValue(RESOURCE_1)); Assert.assertEquals( YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, cs.getMaximumResourceCapability() .getResourceValue(ResourceInformation.MEMORY_URI)); Assert.assertEquals( YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, cs.getMaximumAllocation() .getResourceValue(ResourceInformation.MEMORY_URI)); Assert.assertEquals( YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, cs.getMaximumResourceCapability() .getResourceValue(ResourceInformation.VCORES_URI)); Assert.assertEquals( YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, cs.getMaximumAllocation() .getResourceValue(ResourceInformation.VCORES_URI)); cs.getMaximumResourceCapability().getResourceValue(RESOURCE_1)); Assert.assertEquals(3333L, cs.getMaximumAllocation().getResourceValue(RESOURCE_1)); Assert.assertEquals( YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, cs.getMaximumResourceCapability() .getResourceValue(ResourceInformation.MEMORY_URI)); Assert.assertEquals( YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB,