YARN-11639. CME and NPE in PriorityUtilizationQueueOrderingPolicy (#6455)
This commit is contained in:
parent
54f7a6b127
commit
8243da8cb0
@ -28,6 +28,7 @@
|
|||||||
.CapacitySchedulerConfiguration;
|
.CapacitySchedulerConfiguration;
|
||||||
import org.apache.hadoop.yarn.util.resource.Resources;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -254,9 +255,9 @@ public Iterator<CSQueue> getAssignmentIterator(String partition) {
|
|||||||
// partitionToLookAt is a thread local variable, therefore it is safe to mutate it.
|
// partitionToLookAt is a thread local variable, therefore it is safe to mutate it.
|
||||||
PriorityUtilizationQueueOrderingPolicy.partitionToLookAt.set(partition);
|
PriorityUtilizationQueueOrderingPolicy.partitionToLookAt.set(partition);
|
||||||
|
|
||||||
// Sort the snapshot of the queues in order to avoid breaking the prerequisites of TimSort.
|
// Copy (for thread safety) and sort the snapshot of the queues in order to avoid breaking
|
||||||
// See YARN-10178 for details.
|
// the prerequisites of TimSort. See YARN-10178 for details.
|
||||||
return queues.stream().map(PriorityQueueResourcesForSorting::new).sorted(
|
return new ArrayList<>(queues).stream().map(PriorityQueueResourcesForSorting::new).sorted(
|
||||||
new PriorityQueueComparator()).map(PriorityQueueResourcesForSorting::getQueue).collect(
|
new PriorityQueueComparator()).map(PriorityQueueResourcesForSorting::getQueue).collect(
|
||||||
Collectors.toList()).iterator();
|
Collectors.toList()).iterator();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user