Java Code Examples for org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV#_

The following examples show how to use org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV#_ . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RMAppAttemptBlock.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void createAttemptHeadRoomTable(Block html) {
  RMAppAttempt attempt = getRMAppAttempt();
  if (attempt != null) {
    if (!isApplicationInFinalState(YarnApplicationAttemptState
        .valueOf(attempt.getAppAttemptState().toString()))) {
      RMAppAttemptMetrics metrics = attempt.getRMAppAttemptMetrics();
      DIV<Hamlet> pdiv = html._(InfoBlock.class).div(_INFO_WRAP);
      info("Application Attempt Overview").clear();
      info("Application Attempt Metrics")._(
        "Application Attempt Headroom : ", metrics == null ? "N/A" :
          metrics.getApplicationAttemptHeadroom());
      pdiv._();
    }
  }
}
 
Example 2
Source File: RMAppAttemptBlock.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void createAttemptHeadRoomTable(Block html) {
  RMAppAttempt attempt = getRMAppAttempt();
  if (attempt != null) {
    if (!isApplicationInFinalState(YarnApplicationAttemptState
        .valueOf(attempt.getAppAttemptState().toString()))) {
      RMAppAttemptMetrics metrics = attempt.getRMAppAttemptMetrics();
      DIV<Hamlet> pdiv = html._(InfoBlock.class).div(_INFO_WRAP);
      info("Application Attempt Overview").clear();
      info("Application Attempt Metrics")._(
        "Application Attempt Headroom : ", metrics == null ? "N/A" :
          metrics.getApplicationAttemptHeadroom());
      pdiv._();
    }
  }
}
 
Example 3
Source File: RMAppAttemptBlock.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void createContainerLocalityTable(Block html) {
  RMAppAttemptMetrics attemptMetrics = null;
  RMAppAttempt attempt = getRMAppAttempt();
  if (attempt != null) {
    attemptMetrics = attempt.getRMAppAttemptMetrics();
  }
  
  if (attemptMetrics == null) {
    return;
  }

  DIV<Hamlet> div = html.div(_INFO_WRAP);
  TABLE<DIV<Hamlet>> table =
      div.h3(
        "Total Allocated Containers: "
            + attemptMetrics.getTotalAllocatedContainers()).h3("Each table cell"
          + " represents the number of NodeLocal/RackLocal/OffSwitch containers"
          + " satisfied by NodeLocal/RackLocal/OffSwitch resource requests.").table(
        "#containerLocality");
  table.
    tr().
      th(_TH, "").
      th(_TH, "Node Local Request").
      th(_TH, "Rack Local Request").
      th(_TH, "Off Switch Request").
    _();

  String[] containersType =
      { "Num Node Local Containers (satisfied by)", "Num Rack Local Containers (satisfied by)",
          "Num Off Switch Containers (satisfied by)" };
  boolean odd = false;
  for (int i = 0; i < attemptMetrics.getLocalityStatistics().length; i++) {
    table.tr((odd = !odd) ? _ODD : _EVEN).td(containersType[i])
      .td(String.valueOf(attemptMetrics.getLocalityStatistics()[i][0]))
      .td(i == 0 ? "" : String.valueOf(attemptMetrics.getLocalityStatistics()[i][1]))
      .td(i <= 1 ? "" : String.valueOf(attemptMetrics.getLocalityStatistics()[i][2]))._();
  }
  table._();
  div._();
}
 
Example 4
Source File: RMAppAttemptBlock.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void createContainerLocalityTable(Block html) {
  RMAppAttemptMetrics attemptMetrics = null;
  RMAppAttempt attempt = getRMAppAttempt();
  if (attempt != null) {
    attemptMetrics = attempt.getRMAppAttemptMetrics();
  }
  
  if (attemptMetrics == null) {
    return;
  }

  DIV<Hamlet> div = html.div(_INFO_WRAP);
  TABLE<DIV<Hamlet>> table =
      div.h3(
        "Total Allocated Containers: "
            + attemptMetrics.getTotalAllocatedContainers()).h3("Each table cell"
          + " represents the number of NodeLocal/RackLocal/OffSwitch containers"
          + " satisfied by NodeLocal/RackLocal/OffSwitch resource requests.").table(
        "#containerLocality");
  table.
    tr().
      th(_TH, "").
      th(_TH, "Node Local Request").
      th(_TH, "Rack Local Request").
      th(_TH, "Off Switch Request").
    _();

  String[] containersType =
      { "Num Node Local Containers (satisfied by)", "Num Rack Local Containers (satisfied by)",
          "Num Off Switch Containers (satisfied by)" };
  boolean odd = false;
  for (int i = 0; i < attemptMetrics.getLocalityStatistics().length; i++) {
    table.tr((odd = !odd) ? _ODD : _EVEN).td(containersType[i])
      .td(String.valueOf(attemptMetrics.getLocalityStatistics()[i][0]))
      .td(i == 0 ? "" : String.valueOf(attemptMetrics.getLocalityStatistics()[i][1]))
      .td(i <= 1 ? "" : String.valueOf(attemptMetrics.getLocalityStatistics()[i][2]))._();
  }
  table._();
  div._();
}
 
Example 5
Source File: RMAppAttemptBlock.java    From hadoop with Apache License 2.0 4 votes vote down vote up
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._();
}
 
Example 6
Source File: RMAppBlock.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected void createApplicationMetricsTable(Block html){
  RMApp rmApp = this.rm.getRMContext().getRMApps().get(appID);
  RMAppMetrics appMetrics = rmApp == null ? null : rmApp.getRMAppMetrics();
  // Get attempt metrics and fields, it is possible currentAttempt of RMApp is
  // null. In that case, we will assume resource preempted and number of Non
  // AM container preempted on that attempt is 0
  RMAppAttemptMetrics attemptMetrics;
  if (rmApp == null || null == rmApp.getCurrentAppAttempt()) {
    attemptMetrics = null;
  } else {
    attemptMetrics = rmApp.getCurrentAppAttempt().getRMAppAttemptMetrics();
  }
  Resource attemptResourcePreempted =
      attemptMetrics == null ? Resources.none() : attemptMetrics
        .getResourcePreempted();
  int attemptNumNonAMContainerPreempted =
      attemptMetrics == null ? 0 : attemptMetrics
        .getNumNonAMContainersPreempted();
  DIV<Hamlet> pdiv = html.
      _(InfoBlock.class).
      div(_INFO_WRAP);
  info("Application Overview").clear();
  info("Application Metrics")
      ._("Total Resource Preempted:",
        appMetrics == null ? "N/A" : appMetrics.getResourcePreempted())
      ._("Total Number of Non-AM Containers Preempted:",
        appMetrics == null ? "N/A"
            : appMetrics.getNumNonAMContainersPreempted())
      ._("Total Number of AM Containers Preempted:",
        appMetrics == null ? "N/A"
            : appMetrics.getNumAMContainersPreempted())
      ._("Resource Preempted from Current Attempt:",
        attemptResourcePreempted)
      ._("Number of Non-AM Containers Preempted from Current Attempt:",
        attemptNumNonAMContainerPreempted)
      ._("Aggregate Resource Allocation:",
        String.format("%d MB-seconds, %d vcore-seconds, %d gcore-seconds",
            appMetrics == null ? "N/A" : appMetrics.getMemorySeconds(),
            appMetrics == null ? "N/A" : appMetrics.getVcoreSeconds(),
            appMetrics == null ? "N/A" : appMetrics.getGcoreSeconds()));
  pdiv._();
}
 
Example 7
Source File: RMAppAttemptBlock.java    From big-c with Apache License 2.0 4 votes vote down vote up
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._();
}
 
Example 8
Source File: RMAppBlock.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
protected void createApplicationMetricsTable(Block html){
  RMApp rmApp = this.rm.getRMContext().getRMApps().get(appID);
  RMAppMetrics appMetrics = rmApp == null ? null : rmApp.getRMAppMetrics();
  // Get attempt metrics and fields, it is possible currentAttempt of RMApp is
  // null. In that case, we will assume resource preempted and number of Non
  // AM container preempted on that attempt is 0
  RMAppAttemptMetrics attemptMetrics;
  if (rmApp == null || null == rmApp.getCurrentAppAttempt()) {
    attemptMetrics = null;
  } else {
    attemptMetrics = rmApp.getCurrentAppAttempt().getRMAppAttemptMetrics();
  }
  Resource attemptResourcePreempted =
      attemptMetrics == null ? Resources.none() : attemptMetrics
        .getResourcePreempted();
  int attemptNumNonAMContainerPreempted =
      attemptMetrics == null ? 0 : attemptMetrics
        .getNumNonAMContainersPreempted();
  DIV<Hamlet> pdiv = html.
      _(InfoBlock.class).
      div(_INFO_WRAP);
  info("Application Overview").clear();
  info("Application Metrics")
      ._("Total Resource Preempted:",
        appMetrics == null ? "N/A" : appMetrics.getResourcePreempted())
      ._("Total Number of Non-AM Containers Preempted:",
        appMetrics == null ? "N/A"
            : appMetrics.getNumNonAMContainersPreempted())
      ._("Total Number of AM Containers Preempted:",
        appMetrics == null ? "N/A"
            : appMetrics.getNumAMContainersPreempted())
      ._("Resource Preempted from Current Attempt:",
        attemptResourcePreempted)
      ._("Number of Non-AM Containers Preempted from Current Attempt:",
        attemptNumNonAMContainerPreempted)
      ._("Aggregate Resource Allocation:",
        String.format("%d MB-seconds, %d vcore-seconds",
            appMetrics == null ? "N/A" : appMetrics.getMemorySeconds(),
            appMetrics == null ? "N/A" : appMetrics.getVcoreSeconds()));
  pdiv._();
}