Skip to content

Commit f02b0e1

Browse files
committed
YARN-9581. Add support for get multiple RM webapp URLs.
Contributed by Prabhu Joseph
1 parent 9fd3c70 commit f02b0e1

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/util

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/util/WebAppUtils.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,16 @@ public static <T, R> R execOnActiveRM(Configuration conf,
102102
return func.apply(rm1Address, arg);
103103
} catch (Exception e) {
104104
if (HAUtil.isHAEnabled(conf)) {
105-
String rm2Address = getRMWebAppURLWithScheme(conf, 1);
106-
return func.apply(rm2Address, arg);
105+
int rms = HAUtil.getRMHAIds(conf).size();
106+
for (int i=1; i<rms; i++) {
107+
try {
108+
rm1Address = getRMWebAppURLWithScheme(conf, i);
109+
return func.apply(rm1Address, arg);
110+
} catch (Exception e1) {
111+
// ignore and try next one when RM is down
112+
e = e1;
113+
}
114+
}
107115
}
108116
throw e;
109117
}

0 commit comments

Comments
 (0)