Source:
static void schedule(CapacityScheduler cs) throws InterruptedException{ Collection<FiCaSchedulerNode> nodes = cs.nodeTracker.getAllNodes(); int nodeSize = nodes.size(); if(nodeSize == 0) { return; } if (!cs.multiNodePlacementEnabled) { int current = 0; int start = random.nextInt(nodeSize); boolean printSkipedNodeLogging = false; if (Time.monotonicNow() / 1000 % 10 == 0) { printSkipedNodeLogging = (!printedVerboseLoggingForAsyncScheduling); } else { printedVerboseLoggingForAsyncScheduling = false; } for (FiCaSchedulerNode node : nodes) { if (current++ >= start) { if (shouldSkipNodeSchedule(node, cs, printSkipedNodeLogging)) { continue; } cs.allocateContainersToNode(node.getNodeID(), false); } } current = 0; for (FiCaSchedulerNode node : nodes) { if (current++ > start) { break; } if (shouldSkipNodeSchedule(node, cs, printSkipedNodeLogging)) { continue; } cs.allocateContainersToNode(node.getNodeID(), false); } if (printSkipedNodeLogging) { printedVerboseLoggingForAsyncScheduling = true; } } else { List<String> partitions = cs.nodeTracker.getPartitions(); int partitionSize = partitions.size(); int start = random.nextInt(partitionSize); int current = 0; for (String partititon : partitions) { if (current++ >= start) { cs.allocateContainersToNode(cs.getCandidateNodeSet(partititon), false); } } current = 0; for (String partititon : partitions) { if (current++ > start) { break; } cs.allocateContainersToNode(cs.getCandidateNodeSet(partititon), false); } } Thread.sleep(cs.getAsyncScheduleInterval()); }

Target:
static void schedule(CapacityScheduler cs) throws InterruptedException{ int current = 0; Collection<FiCaSchedulerNode> nodes = cs.nodeTracker.getAllNodes(); int nodeSize = nodes.size(); if(nodeSize == 0) { return; } if (!cs.multiNodePlacementEnabled) { int start = random.nextInt(nodeSize); boolean printSkipedNodeLogging = false; if (Time.monotonicNow() / 1000 % 10 == 0) { printSkipedNodeLogging = (!printedVerboseLoggingForAsyncScheduling); } else { printedVerboseLoggingForAsyncScheduling = false; } for (FiCaSchedulerNode node : nodes) { if (current++ >= start) { if (shouldSkipNodeSchedule(node, cs, printSkipedNodeLogging)) { continue; } cs.allocateContainersToNode(node.getNodeID(), false); } } current = 0; for (FiCaSchedulerNode node : nodes) { if (current++ > start) { break; } if (shouldSkipNodeSchedule(node, cs, printSkipedNodeLogging)) { continue; } cs.allocateContainersToNode(node.getNodeID(), false); } if (printSkipedNodeLogging) { printedVerboseLoggingForAsyncScheduling = true; } } else { List<String> partitions = cs.nodeTracker.getPartitions(); int partitionSize = partitions.size(); int start = random.nextInt(partitionSize); for (String partititon : partitions) { if (current++ >= start) { CandidateNodeSet<FiCaSchedulerNode> candidates = cs.getCandidateNodeSet(partititon); if (candidates == null) { continue; } cs.allocateContainersToNode(candidates, false); } } current = 0; for (String partititon : partitions) { if (current++ > start) { break; } CandidateNodeSet<FiCaSchedulerNode> candidates = cs.getCandidateNodeSet(partititon); if (candidates == null) { continue; } cs.allocateContainersToNode(candidates, false); } } Thread.sleep(cs.getAsyncScheduleInterval()); }