当前位置: 首页>>代码示例>>Java>>正文


Java WebAppUtils.getRMWebAppURLWithScheme方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.webapp.util.WebAppUtils.getRMWebAppURLWithScheme方法的典型用法代码示例。如果您正苦于以下问题:Java WebAppUtils.getRMWebAppURLWithScheme方法的具体用法?Java WebAppUtils.getRMWebAppURLWithScheme怎么用?Java WebAppUtils.getRMWebAppURLWithScheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.webapp.util.WebAppUtils的用法示例。


在下文中一共展示了WebAppUtils.getRMWebAppURLWithScheme方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRMWebUrlSpecified

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Test
public void testRMWebUrlSpecified() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  // seems a bit odd but right now we are forcing webapp for RM to be
  // RM_ADDRESS
  // for host and use the port from the RM_WEBAPP_ADDRESS
  conf.set(YarnConfiguration.RM_WEBAPP_ADDRESS, "fortesting:24543");
  conf.set(YarnConfiguration.RM_ADDRESS, "rmtesting:9999");
  String rmWebUrl = WebAppUtils.getRMWebAppURLWithScheme(conf);
  String[] parts = rmWebUrl.split(":");
  Assert.assertEquals("RM Web URL Port is incrrect", 24543,
      Integer.valueOf(parts[parts.length - 1]).intValue());
  Assert.assertNotSame(
      "RM Web Url not resolved correctly. Should not be rmtesting",
      "http://rmtesting:24543", rmWebUrl);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestYarnConfiguration.java

示例2: testDefaultRMWebUrl

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Test
public void testDefaultRMWebUrl() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  String rmWebUrl = WebAppUtils.getRMWebAppURLWithScheme(conf);
  // shouldn't have a "/" on the end of the url as all the other uri routinnes
  // specifically add slashes and Jetty doesn't handle double slashes.
  Assert.assertNotSame("RM Web Url is not correct", "http://0.0.0.0:8088",
      rmWebUrl);

  // test it in HA scenario
  conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
  conf.set(YarnConfiguration.RM_HA_IDS, "rm1, rm2");
  conf.set("yarn.resourcemanager.webapp.address.rm1", "10.10.10.10:18088");
  conf.set("yarn.resourcemanager.webapp.address.rm2", "20.20.20.20:28088");
  String rmWebUrlinHA = WebAppUtils.getRMWebAppURLWithScheme(conf);
  Assert.assertEquals("http://10.10.10.10:18088", rmWebUrlinHA);

  YarnConfiguration conf2 = new YarnConfiguration();
  conf2.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
  conf2.set(YarnConfiguration.RM_HA_IDS, "rm1, rm2");
  conf2.set("yarn.resourcemanager.hostname.rm1", "30.30.30.30");
  conf2.set("yarn.resourcemanager.hostname.rm2", "40.40.40.40");
  String rmWebUrlinHA2 = WebAppUtils.getRMWebAppURLWithScheme(conf2);
  Assert.assertEquals("http://30.30.30.30:8088", rmWebUrlinHA2);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:26,代码来源:TestYarnConfiguration.java

示例3: testRMWebUrlSpecified

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Test
public void testRMWebUrlSpecified() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  // seems a bit odd but right now we are forcing webapp for RM to be
  // RM_ADDRESS
  // for host and use the port from the RM_WEBAPP_ADDRESS
  conf.set(YarnConfiguration.RM_WEBAPP_ADDRESS, "fortesting:24543");
  conf.set(YarnConfiguration.RM_ADDRESS, "rmtesting:9999");
  String rmWebUrl = WebAppUtils.getRMWebAppURLWithScheme(conf);
  String[] parts = rmWebUrl.split(":");
  Assert.assertEquals("RM Web URL Port is incrrect", 24543,
      Integer.parseInt(parts[parts.length - 1]));
  Assert.assertNotSame(
      "RM Web Url not resolved correctly. Should not be rmtesting",
      "http://rmtesting:24543", rmWebUrl);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:17,代码来源:TestYarnConfiguration.java

示例4: getClusterUrl

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private URL getClusterUrl() throws Exception {
  URL url = null;
  Configuration conf = getConf();
  if (HAUtil.isHAEnabled(conf)) {
    Collection<String> haids = HAUtil.getRMHAIds(conf);
    for (String rmhid : haids) {
      try {
        url = getHAClusterUrl(conf, rmhid);
        if (isActive(url)) {
          break;
        }
      } catch (ConnectException e) {
        // ignore and try second one when one of RM is down
      }
    }
  } else {
    url = new URL(
        WebAppUtils.getRMWebAppURLWithScheme(conf) + CLUSTER_INFO_URL);
  }
  return url;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:22,代码来源:TopCLI.java

示例5: getAMContainerInfoForRMWebService

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private List<JSONObject> getAMContainerInfoForRMWebService(
    Configuration conf, String appId) throws ClientHandlerException,
    UniformInterfaceException, JSONException {
  Client webServiceClient = Client.create();
  String webAppAddress = WebAppUtils.getRMWebAppURLWithScheme(conf);

  WebResource webResource = webServiceClient.resource(webAppAddress);

  ClientResponse response =
      webResource.path("ws").path("v1").path("cluster").path("apps")
        .path(appId).path("appattempts").accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
  JSONObject json =
      response.getEntity(JSONObject.class).getJSONObject("appAttempts");
  JSONArray requests = json.getJSONArray("appAttempt");
  List<JSONObject> amContainersList = new ArrayList<JSONObject>();
  for (int i = 0; i < requests.length(); i++) {
    amContainersList.add(requests.getJSONObject(i));
  }
  return amContainersList;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:22,代码来源:LogsCLI.java

示例6: testDefaultRMWebUrl

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Test
public void testDefaultRMWebUrl() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  String rmWebUrl = WebAppUtils.getRMWebAppURLWithScheme(conf);
  // shouldn't have a "/" on the end of the url as all the other uri routinnes
  // specifically add slashes and Jetty doesn't handle double slashes.
  Assert.assertNotSame("RM Web Url is not correct", "http://0.0.0.0:8088",
      rmWebUrl);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:TestYarnConfiguration.java


注:本文中的org.apache.hadoop.yarn.webapp.util.WebAppUtils.getRMWebAppURLWithScheme方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。