@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(" NAME: " + queueName).append(" CUR: ").append(current) .append(" PEN: ").append(pending).append(" RESERVED: ").append(reserved) .append(" GAR: ").append(getGuaranteed()).append(" NORM: ") .append(Arrays.toString(normalizedGuarantee)) .append(" IDEAL_ASSIGNED: ").append(idealAssigned) .append(" IDEAL_PREEMPT: ").append(toBePreempted) .append(" ACTUAL_PREEMPT: ").append(getActuallyToBePreempted()) .append(" UNTOUCHABLE: ").append(untouchableExtra) .append(" PREEMPTABLE: ").append(preemptableExtra).append("\n"); return sb.toString(); }
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())); }
void appendLogString(StringBuilder sb) { sb.append(queueName).append(", ").append(current.getMemorySize()) .append(", ").append(current.getVirtualCores()).append(", ") .append(pending.getMemorySize()).append(", ") .append(pending.getVirtualCores()).append(", ") .append(getGuaranteed().getMemorySize()).append(", ") .append(getGuaranteed().getVirtualCores()).append(", ") .append(idealAssigned.getMemorySize()).append(", ") .append(idealAssigned.getVirtualCores()).append(", ") .append(toBePreempted.getMemorySize()).append(", ") .append(toBePreempted.getVirtualCores()).append(", ") .append(getActuallyToBePreempted().getMemorySize()).append(", ") .append(getActuallyToBePreempted().getVirtualCores()); }
public static Map<String, Resource> getResToObtainByPartitionForLeafQueue( CapacitySchedulerPreemptionContext context, String queueName, Resource clusterResource) { Map<String, Resource> resToObtainByPartition = new HashMap<>(); // compute resToObtainByPartition considered inter-queue preemption for (TempQueuePerPartition qT : context.getQueuePartitions(queueName)) { if (qT.preemptionDisabled) { continue; } // Only add resToObtainByPartition when actuallyToBePreempted resource >= // 0 if (Resources.greaterThan(context.getResourceCalculator(), clusterResource, qT.getActuallyToBePreempted(), Resources.none())) { resToObtainByPartition.put(qT.partition, Resources.clone(qT.getActuallyToBePreempted())); } } return resToObtainByPartition; }
maxAllowablePreemptLimit); if (Resources.greaterThan(rc, clusterResource, maxIntraQueuePreemptable, tq.getActuallyToBePreempted())) { Resources.subtractFrom(maxIntraQueuePreemptable, tq.getActuallyToBePreempted()); } else { maxIntraQueuePreemptable = Resource.newInstance(0, 0);