xintongsong commented on a change in pull request #12444:
URL: https://github.com/apache/flink/pull/12444#discussion_r436315438



##########
File path: 
flink-yarn/src/main/java/org/apache/flink/yarn/YarnClusterDescriptor.java
##########
@@ -508,7 +508,11 @@ public void killCluster(ApplicationId applicationId) 
throws FlinkException {
                        throw new YarnDeploymentException("Could not retrieve 
information about free cluster resources.", e);
                }
 
-               final int yarnMinAllocationMB = 
yarnConfiguration.getInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 
0);
+               final int yarnMinAllocationMB = yarnConfiguration.getInt(
+                               
YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB,
+                               
YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB);
+               Preconditions.checkArgument(yarnMinAllocationMB > 0, "The 
minimum allocation memory "
+                               + "(" + yarnMinAllocationMB + " MB) configured 
via 'yarn.scheduler.minimum-allocation-mb' should be greater than 0.");

Review comment:
       The string literal can be replaced with 
`YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB`.

##########
File path: 
flink-yarn/src/main/java/org/apache/flink/yarn/YarnClusterDescriptor.java
##########
@@ -508,7 +508,9 @@ public void killCluster(ApplicationId applicationId) throws 
FlinkException {
                        throw new YarnDeploymentException("Could not retrieve 
information about free cluster resources.", e);
                }
 
-               final int yarnMinAllocationMB = 
yarnConfiguration.getInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 
0);
+               final int yarnMinAllocationMB = yarnConfiguration.getInt(

Review comment:
       I think it would be good to always try to throw an exception with the 
most descriptive type if possible. IMO, this should have higher priority than 
keeping the codes concise.
   
   In this case, I would suggest to throw either a `YarnDeploymentException` or 
a `IllegalConfigurationException`, rather than `IllegalStateException` that 
`Preconditions.checkArgument` throws.




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


Reply via email to