Addendum fix for: YARN-7269. Tracking URL in the app state does not get redirected to ApplicationMaster for Running applications. (Wangda Tan)
Change-Id: If1fe4a62e07b25e6f1b8ba803495da87e2cb2df6
(cherry picked from commit 87ea1dff9c
)
This commit is contained in:
parent
f2350f5120
commit
64170eb53c
|
@ -62,15 +62,19 @@ public class AmFilterInitializer extends FilterInitializer {
|
|||
container.addFilter(FILTER_NAME, FILTER_CLASS, params);
|
||||
|
||||
// Handle RM HA urls
|
||||
List<String> urls = new ArrayList<>();
|
||||
|
||||
// Include yarn-site.xml in the classpath
|
||||
YarnConfiguration yarnConf = new YarnConfiguration(conf);
|
||||
for (String rmId : getRmIds(yarnConf)) {
|
||||
String url = getUrlByRmId(yarnConf, rmId);
|
||||
urls.add(url);
|
||||
Collection<String> rmIds = getRmIds(yarnConf);
|
||||
if (rmIds != null) {
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (String rmId : rmIds) {
|
||||
String url = getUrlByRmId(yarnConf, rmId);
|
||||
urls.add(url);
|
||||
}
|
||||
if (!urls.isEmpty()) {
|
||||
params.put(RM_HA_URLS, StringUtils.join(",", urls));
|
||||
}
|
||||
}
|
||||
params.put(RM_HA_URLS, StringUtils.join(",", urls));
|
||||
}
|
||||
|
||||
private Collection<String> getRmIds(Configuration conf) {
|
||||
|
|
|
@ -53,11 +53,11 @@ public class TestAmFilterInitializer extends TestCase {
|
|||
AmFilterInitializer afi = new MockAmFilterInitializer();
|
||||
assertNull(con.givenParameters);
|
||||
afi.initFilter(con, conf);
|
||||
assertEquals(3, con.givenParameters.size());
|
||||
assertEquals(2, con.givenParameters.size());
|
||||
assertEquals("host1", con.givenParameters.get(AmIpFilter.PROXY_HOSTS));
|
||||
assertEquals("http://host1:1000/foo",
|
||||
con.givenParameters.get(AmIpFilter.PROXY_URI_BASES));
|
||||
assertEquals("", con.givenParameters.get(AmFilterInitializer.RM_HA_URLS));
|
||||
assertEquals(null, con.givenParameters.get(AmFilterInitializer.RM_HA_URLS));
|
||||
|
||||
// Check a single RM_WEBAPP_ADDRESS
|
||||
con = new MockFilterContainer();
|
||||
|
@ -66,11 +66,11 @@ public class TestAmFilterInitializer extends TestCase {
|
|||
afi = new MockAmFilterInitializer();
|
||||
assertNull(con.givenParameters);
|
||||
afi.initFilter(con, conf);
|
||||
assertEquals(3, con.givenParameters.size());
|
||||
assertEquals(2, con.givenParameters.size());
|
||||
assertEquals("host2", con.givenParameters.get(AmIpFilter.PROXY_HOSTS));
|
||||
assertEquals("http://host2:2000/foo",
|
||||
con.givenParameters.get(AmIpFilter.PROXY_URI_BASES));
|
||||
assertEquals("", con.givenParameters.get(AmFilterInitializer.RM_HA_URLS));
|
||||
assertEquals(null, con.givenParameters.get(AmFilterInitializer.RM_HA_URLS));
|
||||
|
||||
// Check multiple RM_WEBAPP_ADDRESSes (RM HA)
|
||||
con = new MockFilterContainer();
|
||||
|
|
Loading…
Reference in New Issue