Github user sihuazhou commented on a diff in the pull request: https://github.com/apache/flink/pull/5726#discussion_r175772251 --- Diff: flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java --- @@ -409,6 +411,12 @@ public void terminateCluster(ApplicationId applicationId) throws FlinkException } } + private void checkConfig(ClusterSpecification clusterSpecification) { + long taskManagerMemorySize = clusterSpecification.getTaskManagerMemoryMB(); + long cutoff = ResourceManagerRuntimeServices.calculateCutoffMB(flinkConfiguration, taskManagerMemorySize); + TaskManagerServices.calculateHeapSizeMB(taskManagerMemorySize - cutoff, flinkConfiguration); --- End diff -- Hmm...This is a bit tricky, the `calculation logic` is a bit hard to be separated from the `check logical` so clearly, because when we perform the checking we also need to do the calculation by the way. So pull the `check logical` from the `calculateFunction` to be a separated function means we will have some code duplication. So I'd like to add a comment here, if you still think we should pull out a new function I would just do it ;).
---