zhuzhurk commented on a change in pull request #13284:
URL: https://github.com/apache/flink/pull/13284#discussion_r483962503



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java
##########
@@ -300,6 +305,32 @@ public int getNumberOfVertices() {
                return this.taskVertices.size();
        }
 
+       public Set<SlotSharingGroup> getSlotSharingGroups() {
+               final Set<SlotSharingGroup> slotSharingGroups = new HashSet<>();
+               for (JobVertex vertex : getVertices()) {
+                       final SlotSharingGroup slotSharingGroup = 
vertex.getSlotSharingGroup();
+                       checkNotNull(slotSharingGroup);
+
+                       slotSharingGroups.add(slotSharingGroup);
+               }
+               return Collections.unmodifiableSet(slotSharingGroups);
+       }
+
+       public Set<CoLocationGroupDesc> getCoLocationGroupDescriptors() {
+               final Set<CoLocationGroup> coLocationGroups = new HashSet<>();
+               for (JobVertex vertex : getVertices()) {
+                       CoLocationGroup coLocationGroup = 
vertex.getCoLocationGroup();
+                       if (coLocationGroup != null) {
+                               coLocationGroups.add(coLocationGroup);
+                       }
+               }
+               final Set<CoLocationGroupDesc> coLocationGroupDescs = 
coLocationGroups
+                       .stream()
+                       .map(CoLocationGroupDesc::from)
+                       .collect(Collectors.toSet());

Review comment:
       A comment is added to explain that.
   The loops are also reworked to be in stream format, but in a bit different 
way.
   




----------------------------------------------------------------
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]


Reply via email to