johnyangk commented on a change in pull request #72: [Nemo-59] Skewed
data-aware executor allocation
URL: https://github.com/apache/incubator-nemo/pull/72#discussion_r200861677
##########
File path:
runtime/common/src/main/java/edu/snu/nemo/runtime/common/optimizer/pass/runtime/DataSkewRuntimePass.java
##########
@@ -75,52 +81,75 @@ public PhysicalPlan apply(final PhysicalPlan originalPlan,
.collect(Collectors.toList());
// Get number of evaluators of the next stage (number of blocks).
- final Integer taskListSize =
optimizationEdges.stream().findFirst().orElseThrow(() ->
+ final Integer reducerTaskNum =
optimizationEdges.stream().findFirst().orElseThrow(() ->
new RuntimeException("optimization edges are
empty")).getDst().getTaskIds().size();
// Calculate keyRanges.
- final List<KeyRange> keyRanges = calculateHashRanges(metricData.right(),
taskListSize);
+ final List<KeyRange> keyRanges = calculateHashRanges(metricData.right(),
reducerTaskNum);
// Overwrite the previously assigned hash value range in the physical DAG
with the new range.
optimizationEdges.forEach(optimizationEdge -> {
// Update the information.
- final List<KeyRange> taskIdxToHashRange = new ArrayList<>();
- IntStream.range(0, taskListSize).forEach(i ->
taskIdxToHashRange.add(keyRanges.get(i)));
+ final Map<Integer, KeyRange> taskIdxToHashRange = new HashMap<>();
+ for (int taskIdx = 0; taskIdx < reducerTaskNum; taskIdx++) {
+ taskIdxToHashRange.put(taskIdx, keyRanges.get(taskIdx));
+ }
optimizationEdge.setTaskIdxToKeyRange(taskIdxToHashRange);
});
return new PhysicalPlan(originalPlan.getId(), physicalDAGBuilder.build());
}
+ private boolean containsSkewedHash(final List<Integer> skewedHashes,
+ final int startingHash, final int
finishingHash) {
+ for (int h = startingHash; h < finishingHash; h++) {
+ if (skewedHashes.contains(h)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Method for calculating key ranges to evenly distribute the skewed metric
data.
*
* @param aggregatedMetricData the metric data.
Review comment:
Can you use a more descriptive variable name?
Is this blockIdToblockSize? (though I'm pretty certain that I'm wrong here)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services