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


Java WebAppUtils.getHttpSchemePrefix方法代码示例

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


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

示例1: generateProxyUriWithScheme

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private String generateProxyUriWithScheme() {
  this.readLock.lock();
  try {
    final String scheme = WebAppUtils.getHttpSchemePrefix(conf);
    String proxy = WebAppUtils.getProxyHostAndPort(conf);
    URI proxyUri = ProxyUriUtils.getUriFromAMUrl(scheme, proxy);
    URI result = ProxyUriUtils.getProxyUri(null, proxyUri,
        applicationAttemptId.getApplicationId());
    return result.toASCIIString();
  } catch (URISyntaxException e) {
    LOG.warn("Could not proxify the uri for "
        + applicationAttemptId.getApplicationId(), e);
    return null;
  } finally {
    this.readLock.unlock();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:RMAppAttemptImpl.java

示例2: getAMContainerInfoForAHSWebService

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

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

示例3: generateProxyUriWithScheme

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private String generateProxyUriWithScheme(
    final String trackingUriWithoutScheme) {
  this.readLock.lock();
  try {
    final String scheme = WebAppUtils.getHttpSchemePrefix(conf);
    URI trackingUri = StringUtils.isEmpty(trackingUriWithoutScheme) ? null :
      ProxyUriUtils.getUriFromAMUrl(scheme, trackingUriWithoutScheme);
    String proxy = WebAppUtils.getProxyHostAndPort(conf);
    URI proxyUri = ProxyUriUtils.getUriFromAMUrl(scheme, proxy);
    URI result = ProxyUriUtils.getProxyUri(trackingUri, proxyUri,
        applicationAttemptId.getApplicationId());
    return result.toASCIIString();
  } catch (URISyntaxException e) {
    LOG.warn("Could not proxify "+trackingUriWithoutScheme,e);
    return trackingUriWithoutScheme;
  } finally {
    this.readLock.unlock();
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:20,代码来源:RMAppAttemptImpl.java

示例4: getProxyUrl

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private String getProxyUrl(RMAppAttempt appAttempt) {
  String url = null;
  final String scheme = WebAppUtils.getHttpSchemePrefix(conf);
  try {
    URI trackingUri =
        StringUtils.isEmpty(appAttempt.getOriginalTrackingUrl()) ? null :
            ProxyUriUtils
                .getUriFromAMUrl(scheme, appAttempt.getOriginalTrackingUrl());
    String proxy = WebAppUtils.getProxyHostAndPort(conf);
    URI proxyUri = ProxyUriUtils.getUriFromAMUrl(scheme, proxy);
    URI result = ProxyUriUtils.getProxyUri(trackingUri, proxyUri,
        appAttempt.getAppAttemptId().getApplicationId());
    url = result.toASCIIString();
  } catch (URISyntaxException ex) {
    Assert.fail();
  }
  return url;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:19,代码来源:TestRMAppAttemptTransitions.java

示例5: setup

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Before
public void setup() {
  historyServer = new ApplicationHistoryServer();
  Configuration config = new YarnConfiguration();
  expectedLogUrl = WebAppUtils.getHttpSchemePrefix(config) +
      WebAppUtils.getAHSWebAppURLWithoutScheme(config) +
      "/applicationhistory/logs/localhost:0/container_0_0001_01_000001/" +
      "container_0_0001_01_000001/test user";
  config.setClass(YarnConfiguration.APPLICATION_HISTORY_STORE,
    MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
  historyServer.init(config);
  historyServer.start();
  store =
      ((ApplicationHistoryManagerImpl) historyServer.getApplicationHistory())
        .getHistoryStore();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:17,代码来源:TestApplicationHistoryClientService.java

示例6: getDefaultProxyTrackingUrl

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private String getDefaultProxyTrackingUrl() {
  try {
    final String scheme = WebAppUtils.getHttpSchemePrefix(conf);
    String proxy = WebAppUtils.getProxyHostAndPort(conf);
    URI proxyUri = ProxyUriUtils.getUriFromAMUrl(scheme, proxy);
    URI result = ProxyUriUtils.getProxyUri(null, proxyUri, applicationId);
    return result.toASCIIString();
  } catch (URISyntaxException e) {
    LOG.warn("Could not generate default proxy tracking URL for "
        + applicationId);
    return UNAVAILABLE;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:RMAppImpl.java

示例7: getProxyUrl

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private String getProxyUrl(RMAppAttempt appAttempt) {
  String url = null;
  final String scheme = WebAppUtils.getHttpSchemePrefix(conf);
  try {
    String proxy = WebAppUtils.getProxyHostAndPort(conf);
    URI proxyUri = ProxyUriUtils.getUriFromAMUrl(scheme, proxy);
    URI result = ProxyUriUtils.getProxyUri(null, proxyUri, appAttempt
        .getAppAttemptId().getApplicationId());
    url = result.toASCIIString();
  } catch (URISyntaxException ex) {
    Assert.fail();
  }
  return url;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestRMAppAttemptTransitions.java

示例8: serviceInit

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Override
protected void serviceInit(Configuration conf) throws Exception {
  LOG.info("ApplicationHistory Init");
  historyStore = createApplicationHistoryStore(conf);
  historyStore.init(conf);
  serverHttpAddress = WebAppUtils.getHttpSchemePrefix(conf) +
      WebAppUtils.getAHSWebAppURLWithoutScheme(conf);
  super.serviceInit(conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:ApplicationHistoryManagerImpl.java

示例9: serviceInit

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Override
protected void serviceInit(Configuration conf) throws Exception {
  serverHttpAddress = WebAppUtils.getHttpSchemePrefix(conf) +
      WebAppUtils.getAHSWebAppURLWithoutScheme(conf);
  maxLoadedApplications =
      conf.getLong(YarnConfiguration.APPLICATION_HISTORY_MAX_APPS,
        YarnConfiguration.DEFAULT_APPLICATION_HISTORY_MAX_APPS);
  super.serviceInit(conf);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:10,代码来源:ApplicationHistoryManagerOnTimelineStore.java

示例10: getHAClusterUrl

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@VisibleForTesting
public URL getHAClusterUrl(Configuration conf, String rmhid)
    throws MalformedURLException {
  return new URL(WebAppUtils.getHttpSchemePrefix(conf)
      + WebAppUtils.getResolvedRemoteRMWebAppURLWithoutScheme(conf,
          YarnConfiguration.useHttps(conf) ? Policy.HTTPS_ONLY
              : Policy.HTTP_ONLY,
          rmhid)
      + CLUSTER_INFO_URL);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:11,代码来源:TopCLI.java

示例11: render

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Override public void render(Block html) {
  TBODY<TABLE<Hamlet>> tbody = html.
    table("#apps").
      thead().
        tr().
          th(".id", "ID").
          th(".user", "User").
          th(".name", "Name").
          th(".type", "Application Type").
          th(".queue", "Queue").
          th(".fairshare", "Fair Share").
          th(".starttime", "StartTime").
          th(".finishtime", "FinishTime").
          th(".state", "State").
          th(".finalstatus", "FinalStatus").
          th(".progress", "Progress").
          th(".ui", "Tracking UI")._()._().
      tbody();
  Collection<YarnApplicationState> reqAppStates = null;
  String reqStateString = $(APP_STATE);
  if (reqStateString != null && !reqStateString.isEmpty()) {
    String[] appStateStrings = reqStateString.split(",");
    reqAppStates = new HashSet<YarnApplicationState>(appStateStrings.length);
    for(String stateString : appStateStrings) {
      reqAppStates.add(YarnApplicationState.valueOf(stateString));
    }
  }
  StringBuilder appsTableData = new StringBuilder("[\n");
  for (RMApp app : apps.values()) {
    if (reqAppStates != null && !reqAppStates.contains(app.createApplicationState())) {
      continue;
    }
    AppInfo appInfo = new AppInfo(rm, app, true, WebAppUtils.getHttpSchemePrefix(conf));
    String percent = String.format("%.1f", appInfo.getProgress());
    ApplicationAttemptId attemptId = app.getCurrentAppAttempt().getAppAttemptId();
    int fairShare = fsinfo.getAppFairShare(attemptId);
    if (fairShare == FairSchedulerInfo.INVALID_FAIR_SHARE) {
      // FairScheduler#applications don't have the entry. Skip it.
      continue;
    }
    appsTableData.append("[\"<a href='")
    .append(url("app", appInfo.getAppId())).append("'>")
    .append(appInfo.getAppId()).append("</a>\",\"")
    .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
      appInfo.getUser()))).append("\",\"")
    .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
      appInfo.getName()))).append("\",\"")
    .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
      appInfo.getApplicationType()))).append("\",\"")
    .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
      appInfo.getQueue()))).append("\",\"")
    .append(fairShare).append("\",\"")
    .append(appInfo.getStartTime()).append("\",\"")
    .append(appInfo.getFinishTime()).append("\",\"")
    .append(appInfo.getState()).append("\",\"")
    .append(appInfo.getFinalStatus()).append("\",\"")
    // Progress bar
    .append("<br title='").append(percent)
    .append("'> <div class='").append(C_PROGRESSBAR).append("' title='")
    .append(join(percent, '%')).append("'> ").append("<div class='")
    .append(C_PROGRESSBAR_VALUE).append("' style='")
    .append(join("width:", percent, '%')).append("'> </div> </div>")
    .append("\",\"<a href='");

    String trackingURL =
      !appInfo.isTrackingUrlReady()? "#" : appInfo.getTrackingUrlPretty();
    
    appsTableData.append(trackingURL).append("'>")
    .append(appInfo.getTrackingUI()).append("</a>\"],\n");

  }
  if(appsTableData.charAt(appsTableData.length() - 2) == ',') {
    appsTableData.delete(appsTableData.length()-2, appsTableData.length()-1);
  }
  appsTableData.append("]");
  html.script().$type("text/javascript").
  _("var appsTableData=" + appsTableData)._();

  tbody._()._();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:81,代码来源:FairSchedulerAppsBlock.java

示例12: createResourceRequestsTable

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private void createResourceRequestsTable(Block html) {
  AppInfo app =
      new AppInfo(rm, rm.getRMContext().getRMApps()
        .get(this.appAttemptId.getApplicationId()), true,
        WebAppUtils.getHttpSchemePrefix(conf));

  List<ResourceRequest> resourceRequests = app.getResourceRequests();
  if (resourceRequests == null || resourceRequests.isEmpty()) {
    return;
  }

  DIV<Hamlet> div = html.div(_INFO_WRAP);
  TABLE<DIV<Hamlet>> table =
      div.h3("Total Outstanding Resource Requests: "
        + getTotalResource(resourceRequests)).table(
            "#ResourceRequests");

  table.tr().
    th(_TH, "Priority").
    th(_TH, "ResourceName").
    th(_TH, "Capability").
    th(_TH, "NumContainers").
    th(_TH, "RelaxLocality").
    th(_TH, "NodeLabelExpression").
  _();

  boolean odd = false;
  for (ResourceRequest request : resourceRequests) {
    if (request.getNumContainers() == 0) {
      continue;
    }
    table.tr((odd = !odd) ? _ODD : _EVEN)
      .td(String.valueOf(request.getPriority()))
      .td(request.getResourceName())
      .td(String.valueOf(request.getCapability()))
      .td(String.valueOf(request.getNumContainers()))
      .td(String.valueOf(request.getRelaxLocality()))
      .td(request.getNodeLabelExpression() == null ? "N/A" : request
          .getNodeLabelExpression())._();
  }
  table._();
  div._();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:44,代码来源:RMAppAttemptBlock.java

示例13: createApplicationAttemptTable

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Override
protected void createApplicationAttemptTable(Block html,
    Collection<ApplicationAttemptReport> attempts) {
  TBODY<TABLE<Hamlet>> tbody =
      html.table("#attempts").thead().tr().th(".id", "Attempt ID")
        .th(".started", "Started").th(".node", "Node").th(".logs", "Logs")
        ._()._().tbody();
  RMApp rmApp = this.rm.getRMContext().getRMApps().get(this.appID);
  if (rmApp == null) {
    return;
  }
  StringBuilder attemptsTableData = new StringBuilder("[\n");
  for (final ApplicationAttemptReport appAttemptReport : attempts) {
    RMAppAttempt rmAppAttempt =
        rmApp.getRMAppAttempt(appAttemptReport.getApplicationAttemptId());
    if (rmAppAttempt == null) {
      continue;
    }
    AppAttemptInfo attemptInfo =
        new AppAttemptInfo(rmAppAttempt, rmApp.getUser());
    String nodeLink = attemptInfo.getNodeHttpAddress();
    if (nodeLink != null) {
      nodeLink = WebAppUtils.getHttpSchemePrefix(conf) + nodeLink;
    }
    String logsLink = attemptInfo.getLogsLink();
    attemptsTableData
      .append("[\"<a href='")
      .append(url("appattempt", rmAppAttempt.getAppAttemptId().toString()))
      .append("'>")
      .append(String.valueOf(rmAppAttempt.getAppAttemptId()))
      .append("</a>\",\"")
      .append(attemptInfo.getStartTime())
      .append("\",\"<a ")
      .append(nodeLink == null ? "#" : "href='" + nodeLink)
      .append("'>")
      .append(
        nodeLink == null ? "N/A" : StringEscapeUtils
          .escapeJavaScript(StringEscapeUtils.escapeHtml(nodeLink)))
      .append("</a>\",\"<a ")
      .append(logsLink == null ? "#" : "href='" + logsLink).append("'>")
      .append(logsLink == null ? "N/A" : "Logs").append("</a>\"],\n");
  }
  if (attemptsTableData.charAt(attemptsTableData.length() - 2) == ',') {
    attemptsTableData.delete(attemptsTableData.length() - 2,
      attemptsTableData.length() - 1);
  }
  attemptsTableData.append("]");
  html.script().$type("text/javascript")
    ._("var attemptsTableData=" + attemptsTableData)._();

  tbody._()._();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:53,代码来源:RMAppBlock.java

示例14: serviceInit

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Override
protected void serviceInit(Configuration conf) throws Exception {
  serverHttpAddress = WebAppUtils.getHttpSchemePrefix(conf) +
      WebAppUtils.getAHSWebAppURLWithoutScheme(conf);
  super.serviceInit(conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:ApplicationHistoryManagerOnTimelineStore.java

示例15: generateApplicationTable

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Override
protected void generateApplicationTable(Block html,
    UserGroupInformation callerUGI,
    Collection<ApplicationAttemptReport> attempts) {
  // Application Attempt Table
  Hamlet.TBODY<Hamlet.TABLE<Hamlet>> tbody =
      html.table("#attempts").thead().tr().th(".id", "Attempt ID")
          .th(".started", "Started").th(".node", "Node").th(".logs", "Logs")
          .th(".blacklistednodes", "Blacklisted Nodes")._()._().tbody();

  RMApp rmApp = this.rm.getRMContext().getRMApps().get(this.appID);
  if (rmApp == null) {
    return;
  }
  StringBuilder attemptsTableData = new StringBuilder("[\n");
  for (final ApplicationAttemptReport appAttemptReport : attempts) {
    RMAppAttempt rmAppAttempt =
        rmApp.getRMAppAttempt(appAttemptReport.getApplicationAttemptId());
    if (rmAppAttempt == null) {
      continue;
    }
    AppAttemptInfo attemptInfo =
        new AppAttemptInfo(this.rm, rmAppAttempt, rmApp.getUser(),
            WebAppUtils.getHttpSchemePrefix(conf));
    String blacklistedNodesCount = "N/A";
    Set<String> nodes =
        RMAppAttemptBlock.getBlacklistedNodes(rm,
          rmAppAttempt.getAppAttemptId());
    if(nodes != null) {
      blacklistedNodesCount = String.valueOf(nodes.size());
    }
    String nodeLink = attemptInfo.getNodeHttpAddress();
    if (nodeLink != null) {
      nodeLink = WebAppUtils.getHttpSchemePrefix(conf) + nodeLink;
    }
    String logsLink = attemptInfo.getLogsLink();
    attemptsTableData
        .append("[\"<a href='")
        .append(url("appattempt", rmAppAttempt.getAppAttemptId().toString()))
        .append("'>")
        .append(String.valueOf(rmAppAttempt.getAppAttemptId()))
        .append("</a>\",\"")
        .append(attemptInfo.getStartTime())
        .append("\",\"<a ")
        .append(nodeLink == null ? "#" : "href='" + nodeLink)
        .append("'>")
        .append(nodeLink == null ? "N/A" : StringEscapeUtils
            .escapeJavaScript(StringEscapeUtils.escapeHtml(nodeLink)))
        .append("</a>\",\"<a ")
        .append(logsLink == null ? "#" : "href='" + logsLink).append("'>")
        .append(logsLink == null ? "N/A" : "Logs").append("</a>\",").append(
        "\"").append(blacklistedNodesCount).append("\"],\n");
  }
  if (attemptsTableData.charAt(attemptsTableData.length() - 2) == ',') {
    attemptsTableData.delete(attemptsTableData.length() - 2,
        attemptsTableData.length() - 1);
  }
  attemptsTableData.append("]");
  html.script().$type("text/javascript")
      ._("var attemptsTableData=" + attemptsTableData)._();

  tbody._()._();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:64,代码来源:RMAppBlock.java


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