YARN-9581. Add support for get multiple RM webapp URLs.

Contributed by Prabhu Joseph

(cherry picked from commit f02b0e19940dc6fc1e19258a40db37d1eed89d21)
This commit is contained in:
Eric Yang 2019-06-28 14:51:58 -04:00
parent 252c3a158d
commit 860606fc67

View File

@ -102,8 +102,16 @@ public static <T, R> R execOnActiveRM(Configuration conf,
return func.apply(rm1Address, arg);
} catch (Exception e) {
if (HAUtil.isHAEnabled(conf)) {
String rm2Address = getRMWebAppURLWithScheme(conf, 1);
return func.apply(rm2Address, arg);
int rms = HAUtil.getRMHAIds(conf).size();
for (int i=1; i<rms; i++) {
try {
rm1Address = getRMWebAppURLWithScheme(conf, i);
return func.apply(rm1Address, arg);
} catch (Exception e1) {
// ignore and try next one when RM is down
e = e1;
}
}
}
throw e;
}