/** * Create the actual Resource inside the ApplicationSubmissionContextInfo to * be submitted to the RM from the information provided by the user. * * @param newApp the information provided by the user * @param conf RM configuration * @return returns the constructed Resource inside the * ApplicationSubmissionContextInfo * @throws BadRequestException */ private static Resource createAppSubmissionContextResource( ApplicationSubmissionContextInfo newApp, Configuration conf) throws BadRequestException { if (newApp.getResource().getvCores() > conf.getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES)) { String msg = "Requested more cores than configured max"; throw new BadRequestException(msg); } if (newApp.getResource().getMemorySize() > conf.getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB)) { String msg = "Requested more memory than configured max"; throw new BadRequestException(msg); } Resource r = Resource.newInstance(newApp.getResource().getMemorySize(), newApp.getResource().getvCores()); return r; }
public NewApplication() { applicationId = ""; maximumResourceCapability = new ResourceInfo(); }
protected Resource createAppSubmissionContextResource( ApplicationSubmissionContextInfo newApp) throws BadRequestException { if (newApp.getResource().getvCores() > rm.getConfig().getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES)) { String msg = "Requested more cores than configured max"; throw new BadRequestException(msg); } if (newApp.getResource().getMemory() > rm.getConfig().getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB)) { String msg = "Requested more memory than configured max"; throw new BadRequestException(msg); } Resource r = Resource.newInstance(newApp.getResource().getMemory(), newApp .getResource().getvCores()); return r; }
schedulingPolicy = queue.getPolicy().getName(); clusterResources = new ResourceInfo(scheduler.getClusterResource()); usedResources = new ResourceInfo(queue.getResourceUsage()); fractionMemUsed = (float)usedResources.getMemory() / clusterResources.getMemory(); steadyFairResources = new ResourceInfo(queue.getSteadyFairShare()); fairResources = new ResourceInfo(queue.getFairShare()); minResources = new ResourceInfo(queue.getMinShare()); maxResources = new ResourceInfo(queue.getMaxShare()); maxResources = new ResourceInfo( Resources.componentwiseMin(queue.getMaxShare(), scheduler.getClusterResource())); (float)steadyFairResources.getMemory() / clusterResources.getMemory(); fractionMemFairShare = (float) fairResources.getMemory() / clusterResources.getMemory(); fractionMemMinShare = (float)minResources.getMemory() / clusterResources.getMemory(); fractionMemMaxShare = (float)maxResources.getMemory() / clusterResources.getMemory();
@Override protected void render(Block html) { ResponseInfo ri = info("\'" + qinfo.getQueueName() + "\' Queue Status"). __("Used Resources:", qinfo.getUsedResources().toString()). __("Min Resources:", qinfo.getMinResources().toString()). __("Max Resources:", qinfo.getMaxResources().toString()). __("Max Container Allocation:", qinfo.getMaxContainerAllocation().toString()). __("Reserved Resources:", qinfo.getReservedResources().toString()); int maxApps = qinfo.getMaxApplications(); if (maxApps < Integer.MAX_VALUE) { ri.__("Max Running Applications:", qinfo.getMaxApplications()); } ri.__(STEADY_FAIR_SHARE + ":", qinfo.getSteadyFairShare().toString()); ri.__(INSTANTANEOUS_FAIR_SHARE + ":", qinfo.getFairShare().toString()); html.__(InfoBlock.class); // clear the info contents so this queue's info doesn't accumulate into another queue's info ri.clear(); } }
? new ResourceInfo(Resources.none()) : resourceUsages.getAmUsed(); ri. __("Used Capacity:", appendPercent(resourceUsages.getUsed().toString(), capacities.getUsedCapacity() / 100)) .__("Configured Capacity:", capacities.getConfiguredMinResource().toString()) .__("Configured Max Capacity:", (capacities.getConfiguredMaxResource() == null || capacities.getConfiguredMaxResource().getResource() .equals(Resources.none())) ? "unlimited" : capacities.getConfiguredMaxResource().toString()) .__("Effective Capacity:", appendPercent(capacities.getEffectiveMinResource().toString(), capacities.getCapacity() / 100)) .__("Effective Max Capacity:", appendPercent(capacities.getEffectiveMaxResource().toString(), capacities.getMaxCapacity() / 100)) .__("Absolute Used Capacity:", .__("Absolute Configured Max Capacity:", percent(capacities.getAbsoluteMaxCapacity() / 100)) .__("Used Resources:", resourceUsages.getUsed().toString()) .__("Configured Max Application Master Limit:", StringUtils.format("%.1f", capacities.getMaxAMLimitPercentage())) .__("Max Application Master Resources:", resourceUsages.getAMLimit().toString())
appInfo.getResource().setMemory( rm.getConfig().getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB) + 1); appInfo.getResource().setvCores(1); response = this.constructWebResource(urlPath).accept(acceptMedia) appInfo.getResource().setvCores( rm.getConfig().getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES) + 1); appInfo.getResource().setMemory(CONTAINER_MB); response = this.constructWebResource(urlPath).accept(acceptMedia)
clusterResources = new ResourceInfo(scheduler.getClusterResource()); amUsedResources = new ResourceInfo(Resource.newInstance( queue.getMetrics().getAMResourceUsageMB(), queue.getMetrics().getAMResourceUsageVCores())); amMaxResources = new ResourceInfo(Resource.newInstance( queue.getMetrics().getMaxAMShareMB(), queue.getMetrics().getMaxAMShareVCores())); usedResources = new ResourceInfo(queue.getResourceUsage()); demandResources = new ResourceInfo(queue.getDemand()); fractionMemUsed = (float)usedResources.getMemorySize() / clusterResources.getMemorySize(); steadyFairResources = new ResourceInfo(queue.getSteadyFairShare()); fairResources = new ResourceInfo(queue.getFairShare()); minResources = new ResourceInfo(queue.getMinShare()); maxResources = new ResourceInfo( Resources.componentwiseMin(queue.getMaxShare(), scheduler.getClusterResource())); maxContainerAllocation = new ResourceInfo(scheduler.getMaximumResourceCapability(queueName)); reservedResources = new ResourceInfo(queue.getReservedResource()); (float)steadyFairResources.getMemorySize() / clusterResources.getMemorySize(); fractionMemFairShare = (float) fairResources.getMemorySize() / clusterResources.getMemorySize(); fractionMemMaxShare = (float)maxResources.getMemorySize() / clusterResources.getMemorySize();
@Override protected void render(Block html) { ResponseInfo ri = info("\'" + qinfo.getQueueName() + "\' Queue Status"). __("Used Resources:", qinfo.getUsedResources().toString()). __("Demand Resources:", qinfo.getDemandResources().toString()). __("AM Used Resources:", qinfo.getAMUsedResources().toString()). __("AM Max Resources:", qinfo.getAMMaxResources().toString()). __("Num Active Applications:", qinfo.getNumActiveApplications()). __("Num Pending Applications:", qinfo.getNumPendingApplications()). __("Min Resources:", qinfo.getMinResources().toString()). __("Max Resources:", qinfo.getMaxResources().toString()). __("Max Container Allocation:", qinfo.getMaxContainerAllocation().toString()). __("Reserved Resources:", qinfo.getReservedResources().toString()); int maxApps = qinfo.getMaxApplications(); if (maxApps < Integer.MAX_VALUE) { ri.__("Max Running Applications:", qinfo.getMaxApplications()); } ri.__(STEADY_FAIR_SHARE + ":", qinfo.getSteadyFairShare().toString()); ri.__(INSTANTANEOUS_FAIR_SHARE + ":", qinfo.getFairShare().toString()); ri.__("Preemptable:", qinfo.isPreemptable()); html.__(InfoBlock.class); // clear the info contents so this queue's info doesn't accumulate into another queue's info ri.clear(); } }
new ResourceInfo( Resources.multiply(userAMLimitPerPartition.getResource(), userInfo.getUserWeight())); amUsed = new ResourceInfo(Resources.none()); .td(userInfo.getUserResourceLimit().toString()) .td(String.valueOf(userInfo.getUserWeight())) .td(resourcesUsed.toString()) .td(userAMLimitPerPartition.toString()) .td(amUsed.toString()) .td(Integer.toString(userInfo.getNumActiveApplications())) .td(Integer.toString(userInfo.getNumPendingApplications())).__();
appInfo.getResource().setMemory( rm.getConfig().getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB) + 1); appInfo.getResource().setvCores(1); response = this.constructWebResource(urlPath).accept(acceptMedia) appInfo.getResource().setvCores( rm.getConfig().getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES) + 1); appInfo.getResource().setMemory(CONTAINER_MB); response = this.constructWebResource(urlPath).accept(acceptMedia)
schedulingPolicy = queue.getPolicy().getName(); clusterResources = new ResourceInfo(scheduler.getClusterResource()); usedResources = new ResourceInfo(queue.getResourceUsage()); fractionMemUsed = (float)usedResources.getMemory() / clusterResources.getMemory(); steadyFairResources = new ResourceInfo(queue.getSteadyFairShare()); fairResources = new ResourceInfo(queue.getFairShare()); minResources = new ResourceInfo(queue.getMinShare()); maxResources = new ResourceInfo(queue.getMaxShare()); maxResources = new ResourceInfo( Resources.componentwiseMin(queue.getMaxShare(), scheduler.getClusterResource())); (float)steadyFairResources.getMemory() / clusterResources.getMemory(); fractionMemFairShare = (float) fairResources.getMemory() / clusterResources.getMemory(); fractionMemMinShare = (float)minResources.getMemory() / clusterResources.getMemory(); fractionMemMaxShare = (float)maxResources.getMemory() / clusterResources.getMemory();
LastRunDetails(String operation, long count, Resource resource) { this.operation = operation; this.count = count; this.resources = new ResourceInfo(resource); }
ResourceInfo rInfo = resReqInfo.getCapability(); Resource capability = Resource.newInstance(rInfo.getMemorySize(), rInfo.getvCores()); int numContainers = resReqInfo.getNumContainers(); int minConcurrency = resReqInfo.getMinConcurrency();
protected Resource createAppSubmissionContextResource( ApplicationSubmissionContextInfo newApp) throws BadRequestException { if (newApp.getResource().getvCores() > rm.getConfig().getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES)) { String msg = "Requested more cores than configured max"; throw new BadRequestException(msg); } if (newApp.getResource().getMemory() > rm.getConfig().getInt( YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, YarnConfiguration.DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB)) { String msg = "Requested more memory than configured max"; throw new BadRequestException(msg); } Resource r = Resource.newInstance(newApp.getResource().getMemory(), newApp .getResource().getvCores()); return r; }
@Override protected void render(Block html) { ResponseInfo ri = info("\'" + qinfo.getQueueName() + "\' Queue Status"). _("Used Resources:", qinfo.getUsedResources().toString()). _("Num Active Applications:", qinfo.getNumActiveApplications()). _("Num Pending Applications:", qinfo.getNumPendingApplications()). _("Min Resources:", qinfo.getMinResources().toString()). _("Max Resources:", qinfo.getMaxResources().toString()); int maxApps = qinfo.getMaxApplications(); if (maxApps < Integer.MAX_VALUE) { ri._("Max Running Applications:", qinfo.getMaxApplications()); } ri._(STEADY_FAIR_SHARE + ":", qinfo.getSteadyFairShare().toString()); ri._(INSTANTANEOUS_FAIR_SHARE + ":", qinfo.getFairShare().toString()); html._(InfoBlock.class); // clear the info contents so this queue's info doesn't accumulate into another queue's info ri.clear(); } }
UserInfo(String username, Resource resUsed, int activeApps, int pendingApps, Resource amResUsed, Resource resourceLimit) { this.username = username; this.resourcesUsed = new ResourceInfo(resUsed); this.numActiveApplications = activeApps; this.numPendingApplications = pendingApps; this.AMResourceUsed = new ResourceInfo(amResUsed); this.userResourceLimit = new ResourceInfo(resourceLimit); }
ResourceInfo rInfo = resReqInfo.getCapability(); Resource capability = Resource.newInstance(rInfo.getMemorySize(), rInfo.getvCores()); int numContainers = resReqInfo.getNumContainers(); int minConcurrency = resReqInfo.getMinConcurrency();
assertEquals(2, newNumAppsRoot); assertEquals(3 * GB, origOldA1.getResourcesUsed().getMemory()); assertEquals(1, origOldA1.getResourcesUsed().getvCores()); assertEquals(0, origNewA1.getResourcesUsed().getMemory()); // after the move assertEquals(0, origNewA1.getResourcesUsed().getvCores()); // after the move assertEquals(3 * GB, targetNewA2.getResourcesUsed().getMemory()); assertEquals(1, targetNewA2.getResourcesUsed().getvCores()); assertEquals(0, targetOldA2.getResourcesUsed().getMemory()); assertEquals(0, targetOldA2.getResourcesUsed().getvCores()); .getResourcesUsed().getMemory()); .getResourcesUsed().getvCores()); .getResourcesUsed().getMemory()); .getResourcesUsed().getvCores());