GJL commented on a change in pull request #11770: [FLINK-17014][runtime]
Implement PipelinedRegionSchedulingStrategy
URL: https://github.com/apache/flink/pull/11770#discussion_r409755123
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/strategy/SchedulingStrategyUtils.java
##########
@@ -60,4 +61,18 @@
deploymentOptionRetriever.apply(executionVertexID)))
.collect(Collectors.toList());
}
+
+ static List<SchedulingPipelinedRegion<?, ?>>
sortPipelinedRegionsInTopologicalOrder(
+ final SchedulingTopology<?, ?> topology,
+ final Set<SchedulingPipelinedRegion<?, ?>> regions) {
+
+ final Set<SchedulingPipelinedRegion<?, ?>> deduplicator = new
HashSet<>();
+ return IterableUtils.toStream(topology.getVertices())
+ .map(SchedulingExecutionVertex::getId)
+ .map(topology::getPipelinedRegionOfVertex)
+ .filter(regions::contains)
+ .filter(region -> !deduplicator.contains(region))
+ .filter(deduplicator::add)
Review comment:
Is the first line needed? `Set#add()` returns `false` if the item was not
added.
Also, consider using `.distinct()` since side effects in stream operations
are frowned upon:
> predicate – a non-interfering, stateless predicate to apply to each
element to determine if it should be included

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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