slfan1989 commented on code in PR #5672:
URL: https://github.com/apache/hadoop/pull/5672#discussion_r1199137369


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java:
##########
@@ -703,6 +703,24 @@ protected static void validateConfigs(Configuration conf) {
           + ", " + YarnConfiguration.RM_NM_HEARTBEAT_INTERVAL_MS + "="
           + heartbeatIntvl);
     }
+
+    if (HAUtil.isFederationEnabled(conf)) {
+      /*
+       * In Yarn Federation, we need UAMs in secondary sub-clusters to stay
+       * alive when the next attempt AM in home sub-cluster gets launched. If
+       * the previous AM died because the node is lost after NM timeout. It 
will
+       * already be too late if AM timeout is even shorter.
+       */
+      int amExpireIntvl = 
conf.getInt(YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS,

Review Comment:
   @goiri  We can first check if the user's parameter consists entirely of 
numbers. If it does, we will use getInt for parsing. If it does not consist 
entirely of digits, we will use getTimeDuration for parsing. Can we rewrite the 
code like this?
   
   ```
   String rmAmExpiryIntervalMS = 
conf.get(YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS);
   long amExpireIntvl;
   if (NumberUtils.isDigits(rmAmExpiryIntervalMS)) {
     amExpireIntvl = conf.getLong(YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS,
         YarnConfiguration.DEFAULT_RM_AM_EXPIRY_INTERVAL_MS);
   } else {
     amExpireIntvl = 
conf.getTimeDuration(YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS,
         YarnConfiguration.DEFAULT_RM_AM_EXPIRY_INTERVAL_MS, 
TimeUnit.MILLISECONDS);
   }
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to