azagrebin commented on a change in pull request #13284: URL: https://github.com/apache/flink/pull/13284#discussion_r480166064
########## 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: ```suggestion final Set<CoLocationGroupDesc> coLocationGroupDescs = new HashSet<>(); for (JobVertex vertex : getVertices()) { CoLocationGroup coLocationGroup = vertex.getCoLocationGroup(); if (coLocationGroup != null) { CoLocationGroupDesc coLocationGroupDesc = CoLocationGroupDesc.from(coLocationGroup) coLocationGroupDescs.add(coLocationGroupDesc); } } ``` ---------------------------------------------------------------- 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: us...@infra.apache.org