zhuzhurk commented on a change in pull request #10200: [FLINK-14062][runtime]
Calculate managed memory fraction based on slot sharing groups
URL: https://github.com/apache/flink/pull/10200#discussion_r347083742
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java
##########
@@ -684,6 +689,96 @@ private void setCoLocation() {
}
}
+ private void setManagedMemoryFraction() {
+ // all slot sharing groups in this job
+ final Set<SlotSharingGroup> slotSharingGroups =
Collections.newSetFromMap(new IdentityHashMap<>());
+ // maps a job vertex ID to its head operator ID
+ final Map<JobVertexID, Integer> vertexHeadOperators = new
HashMap<>();
+ // maps a job vertex ID to IDs of all operators in the vertex
+ final Map<JobVertexID, Set<Integer>> vertexOperators = new
HashMap<>();
+
+ for (Entry<Integer, JobVertex> entry : jobVertices.entrySet()) {
+ final int headOperatorId = entry.getKey();
+ final JobVertex jobVertex = entry.getValue();
+
+ final SlotSharingGroup jobVertexSlotSharingGroup =
jobVertex.getSlotSharingGroup();
+ if (jobVertexSlotSharingGroup != null) {
Review comment:
Currently there is no way to set it null in production. `StreamJobGenerator`
would always assign a non-null slot sharing group to `StreamNode`, and that
would be the group of the generated `JobVertex`. (For the case of DataSet all
vertices are in the "default" group.)
However, the nullable assumption of slotSharingGroup is respected in many
places, including @Nullable markers in many places and single slot allocation
code paths in `SchedulerImpl`.
Dealing with job vertex with null slot sharing group does not make much
sense currently, and we can hardly test it in normal ways.
How about keeping it simple by just adding a check to ensure the job vertex
slot sharing group is not null? And also open a follow up issue to determine
whether to support null slot sharing group in runtime?
----------------------------------------------------------------
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