private void logToCSV(List<TempQueue> unorderedqueues){ List<TempQueue> queues = new ArrayList<TempQueue>(unorderedqueues); Collections.sort(queues, new Comparator<TempQueue>(){ @Override public int compare(TempQueue o1, TempQueue o2) { return o1.queueName.compareTo(o2.queueName); }}); String queueState = " QUEUESTATE: " + clock.getTime(); StringBuilder sb = new StringBuilder(); sb.append(queueState); for (TempQueue tq : queues) { sb.append(", "); tq.appendLogString(sb); } LOG.debug(sb.toString()); }
/** * This method recursively computes the ideal assignment of resources to each * level of the hierarchy. This ensures that leafs that are over-capacity but * with parents within capacity will not be preempted. Preemptions are allowed * within each subtree according to local over/under capacity. * * @param root the root of the cloned queue hierachy * @param totalPreemptionAllowed maximum amount of preemption allowed * @return a list of leaf queues updated with preemption targets */ private List<TempQueue> recursivelyComputeIdealAssignment( TempQueue root, Resource totalPreemptionAllowed) { List<TempQueue> leafs = new ArrayList<TempQueue>(); if (root.getChildren() != null && root.getChildren().size() > 0) { // compute ideal distribution at this level computeIdealResourceDistribution(rc, root.getChildren(), totalPreemptionAllowed, root.idealAssigned); // compute recursively for lower levels and build list of leafs for(TempQueue t : root.getChildren()) { leafs.addAll(recursivelyComputeIdealAssignment(t, totalPreemptionAllowed)); } } else { // we are in a leaf nothing to do, just return yourself return Collections.singletonList(root); } return leafs; }
public void printAll() { LOG.info(this.toString()); for (TempQueue sub : this.getChildren()) { sub.printAll(); } }
t.assignPreemption(scalingFactor, rc, tot_guarant);
Resource wQavail = Resources.multiplyAndNormalizeUp(rc, unassigned, sub.normalizedGuarantee, Resource.newInstance(1, 1)); Resource wQidle = sub.offer(wQavail, rc, tot_guarant); Resource wQdone = Resources.subtract(wQavail, wQidle);
t.assignPreemption(scalingFactor, rc, tot_guarant);
Resource wQavail = Resources.multiplyAndNormalizeUp(rc, unassigned, sub.normalizedGuarantee, Resource.newInstance(1, 1)); Resource wQidle = sub.offer(wQavail, rc, tot_guarant); Resource wQdone = Resources.subtract(wQavail, wQidle);
Resource pending = l.getTotalPendingResourcesConsideringUserLimit(clusterResources); ret = new TempQueue(queueName, current, pending, guaranteed, maxCapacity, preemptionDisabled); if (preemptionDisabled) { ret.preemptableExtra = extra; ret.setLeafQueue(l); } else { Resource pending = Resource.newInstance(0, 0); ret = new TempQueue(root.getQueueName(), current, pending, guaranteed, maxCapacity, false); Resource childrensPreemptable = Resource.newInstance(0, 0); TempQueue subq = cloneQueues(c, clusterResources); Resources.addTo(childrensPreemptable, subq.preemptableExtra); ret.addChild(subq);
Resource pending = l.getTotalPendingResourcesConsideringUserLimit(clusterResources); ret = new TempQueue(queueName, current, pending, guaranteed, maxCapacity, preemptionDisabled); if (preemptionDisabled) { ret.preemptableExtra = extra; ret.setLeafQueue(l); } else { Resource pending = Resource.newInstance(0, 0); ret = new TempQueue(root.getQueueName(), current, pending, guaranteed, maxCapacity, false); Resource childrensPreemptable = Resource.newInstance(0, 0); TempQueue subq = cloneQueues(c, clusterResources); Resources.addTo(childrensPreemptable, subq.preemptableExtra); ret.addChild(subq);
/** * This method recursively computes the ideal assignment of resources to each * level of the hierarchy. This ensures that leafs that are over-capacity but * with parents within capacity will not be preempted. Preemptions are allowed * within each subtree according to local over/under capacity. * * @param root the root of the cloned queue hierachy * @param totalPreemptionAllowed maximum amount of preemption allowed * @return a list of leaf queues updated with preemption targets */ private List<TempQueue> recursivelyComputeIdealAssignment( TempQueue root, Resource totalPreemptionAllowed) { List<TempQueue> leafs = new ArrayList<TempQueue>(); if (root.getChildren() != null && root.getChildren().size() > 0) { // compute ideal distribution at this level computeIdealResourceDistribution(rc, root.getChildren(), totalPreemptionAllowed, root.idealAssigned); // compute recursively for lower levels and build list of leafs for(TempQueue t : root.getChildren()) { leafs.addAll(recursivelyComputeIdealAssignment(t, totalPreemptionAllowed)); } } else { // we are in a leaf nothing to do, just return yourself return Collections.singletonList(root); } return leafs; }
private void logToCSV(List<TempQueue> unorderedqueues){ List<TempQueue> queues = new ArrayList<TempQueue>(unorderedqueues); Collections.sort(queues, new Comparator<TempQueue>(){ @Override public int compare(TempQueue o1, TempQueue o2) { return o1.queueName.compareTo(o2.queueName); }}); String queueState = " QUEUESTATE: " + clock.getTime(); StringBuilder sb = new StringBuilder(); sb.append(queueState); for (TempQueue tq : queues) { sb.append(", "); tq.appendLogString(sb); } LOG.debug(sb.toString()); }
public void printAll() { LOG.info(this.toString()); for (TempQueue sub : this.getChildren()) { sub.printAll(); } }