org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV Java Examples

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 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 #2
Source File: NavBlock.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override public void render(Block html) {
  UL<DIV<Hamlet>> mainList = html.
    div("#nav").
      h3("Cluster").
      ul().
        li().a(url("cluster"), "About")._().
        li().a(url("nodes"), "Nodes")._().
        li().a(url("nodelabels"), "Node Labels")._();
  UL<LI<UL<DIV<Hamlet>>>> subAppsList = mainList.
        li().a(url("apps"), "Applications").
          ul();
  subAppsList.li()._();
  for (YarnApplicationState state : YarnApplicationState.values()) {
    subAppsList.
            li().a(url("apps", state.toString()), state.toString())._();
  }
  subAppsList._()._();
  mainList.
        li().a(url("scheduler"), "Scheduler")._()._().
      h3("Tools").
      ul().
        li().a("/conf", "Configuration")._().
        li().a("/logs", "Local logs")._().
        li().a("/stacks", "Server stacks")._().
        li().a("/jmx?qry=Hadoop:*", "Server metrics")._()._()._();
}
 
Example #3
Source File: NavBlock.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override public void render(Block html) {
  UL<DIV<Hamlet>> mainList = html.
    div("#nav").
      h3("Cluster").
      ul().
        li().a(url("cluster"), "About")._().
        li().a(url("nodes"), "Nodes")._().
        li().a(url("nodelabels"), "Node Labels")._();
  UL<LI<UL<DIV<Hamlet>>>> subAppsList = mainList.
        li().a(url("apps"), "Applications").
          ul();
  subAppsList.li()._();
  for (YarnApplicationState state : YarnApplicationState.values()) {
    subAppsList.
            li().a(url("apps", state.toString()), state.toString())._();
  }
  subAppsList._()._();
  mainList.
        li().a(url("scheduler"), "Scheduler")._()._().
      h3("Tools").
      ul().
        li().a("/conf", "Configuration")._().
        li().a("/logs", "Local logs")._().
        li().a("/stacks", "Server stacks")._().
        li().a("/jmx?qry=Hadoop:*", "Server metrics")._()._()._();
}
 
Example #4
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 #5
Source File: HsNavBlock.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override protected void render(Block html) {
  DIV<Hamlet> nav = html.
    div("#nav").
    h3("Application").
      ul().
        li().a(url("about"), "About")._().
        li().a(url("app"), "Jobs")._()._();
  if (app.getJob() != null) {
    String jobid = MRApps.toString(app.getJob().getID());
    nav.
      h3("Job").
      ul().
        li().a(url("job", jobid), "Overview")._().
        li().a(url("jobcounters", jobid), "Counters")._().
        li().a(url("conf", jobid), "Configuration")._().
        li().a(url("tasks", jobid, "m"), "Map tasks")._().
        li().a(url("tasks", jobid, "r"), "Reduce tasks")._()._();
    if (app.getTask() != null) {
      String taskid = MRApps.toString(app.getTask().getID());
      nav.
        h3("Task").
        ul().
          li().a(url("task", taskid), "Task Overview")._().
          li().a(url("taskcounters", taskid), "Counters")._()._();
    }
  }
  nav.
    h3("Tools").
      ul().
        li().a("/conf", "Configuration")._().
        li().a("/logs", "Local logs")._().
        li().a("/stacks", "Server stacks")._().
        li().a("/jmx?qry=Hadoop:*", "Server metrics")._()._()._();
}
 
Example #6
Source File: HsNavBlock.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override protected void render(Block html) {
  DIV<Hamlet> nav = html.
    div("#nav").
    h3("Application").
      ul().
        li().a(url("about"), "About")._().
        li().a(url("app"), "Jobs")._()._();
  if (app.getJob() != null) {
    String jobid = MRApps.toString(app.getJob().getID());
    nav.
      h3("Job").
      ul().
        li().a(url("job", jobid), "Overview")._().
        li().a(url("jobcounters", jobid), "Counters")._().
        li().a(url("conf", jobid), "Configuration")._().
        li().a(url("tasks", jobid, "m"), "Map tasks")._().
        li().a(url("tasks", jobid, "r"), "Reduce tasks")._()._();
    if (app.getTask() != null) {
      String taskid = MRApps.toString(app.getTask().getID());
      nav.
        h3("Task").
        ul().
          li().a(url("task", taskid), "Task Overview")._().
          li().a(url("taskcounters", taskid), "Counters")._()._();
    }
  }
  nav.
    h3("Tools").
      ul().
        li().a("/conf", "Configuration")._().
        li().a("/logs", "Local logs")._().
        li().a("/stacks", "Server stacks")._().
        li().a("/jmx?qry=Hadoop:*", "Server metrics")._()._()._();
}
 
Example #7
Source File: SingleCounterBlock.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override protected void render(Block html) {
  if (job == null) {
    html.
      p()._("Sorry, no counters for nonexistent", $(JOB_ID, "job"))._();
    return;
  }
  if (!$(TASK_ID).isEmpty() && task == null) {
    html.
      p()._("Sorry, no counters for nonexistent", $(TASK_ID, "task"))._();
    return;
  }
  
  String columnType = task == null ? "Task" : "Task Attempt";
  
  TBODY<TABLE<DIV<Hamlet>>> tbody = html.
    div(_INFO_WRAP).
    table("#singleCounter").
      thead().
        tr().
          th(".ui-state-default", columnType).
          th(".ui-state-default", "Value")._()._().
        tbody();
  for (Map.Entry<String, Long> entry : values.entrySet()) {
    TR<TBODY<TABLE<DIV<Hamlet>>>> row = tbody.tr();
    String id = entry.getKey();
    String val = entry.getValue().toString();
    if(task != null) {
      row.td(id);
      row.td().br().$title(val)._()._(val)._();
    } else {
      row.td().a(url("singletaskcounter",entry.getKey(),
          $(COUNTER_GROUP), $(COUNTER_NAME)), id)._();
      row.td().br().$title(val)._().a(url("singletaskcounter",entry.getKey(),
          $(COUNTER_GROUP), $(COUNTER_NAME)), val)._();
    }
    row._();
  }
  tbody._()._()._();
}
 
Example #8
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 #9
Source File: DefaultSchedulerPage.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public void render(Block html) {
  html._(MetricsOverviewTable.class);
  UL<DIV<DIV<Hamlet>>> ul = html.
    div("#cs-wrapper.ui-widget").
      div(".ui-widget-header.ui-corner-top").
        _("FifoScheduler Queue")._().
      div("#cs.ui-widget-content.ui-corner-bottom").
        ul();

  if (fs == null) {
    ul.
      li().
        a(_Q).$style(width(WIDTH_F)).
          span().$style(Q_END)._("100% ")._().
          span(".q", "default")._()._();
  } else {
    float used = sinfo.getUsedCapacity();
    float set = sinfo.getCapacity();
    float delta = Math.abs(set - used) + 0.001f;
    ul.
      li().
        a(_Q).$style(width(WIDTH_F)).
          $title(join("used:", percent(used))).
          span().$style(Q_END)._("100%")._().
          span().$style(join(width(delta), ';', used > set ? OVER : UNDER,
            ';', used > set ? left(set) : left(used)))._(".")._().
          span(".q", sinfo.getQueueName())._().
        _(QueueInfoBlock.class)._();
  }

  ul._()._().
  script().$type("text/javascript").
      _("$('#cs').hide();")._()._().
  _(AppsBlock.class);
}
 
Example #10
Source File: ContainerPage.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void render(Block html) {
  ContainerId containerID;
  try {
    containerID = ConverterUtils.toContainerId($(CONTAINER_ID));
  } catch (IllegalArgumentException e) {
    html.p()._("Invalid containerId " + $(CONTAINER_ID))._();
    return;
  }

  DIV<Hamlet> div = html.div("#content");
  Container container = this.nmContext.getContainers().get(containerID);
  if (container == null) {
    div.h1("Unknown Container. Container might have completed, "
            + "please go back to the previous page and retry.")._();
    return;
  }
  ContainerInfo info = new ContainerInfo(this.nmContext, container);

  info("Container information")
    ._("ContainerID", info.getId())
    ._("ContainerState", info.getState())
    ._("ExitStatus", info.getExitStatus())
    ._("Diagnostics", info.getDiagnostics())
    ._("User", info.getUser())
    ._("TotalMemoryNeeded", info.getMemoryNeeded())
    ._("TotalVCoresNeeded", info.getVCoresNeeded())
    ._("logs", info.getShortLogLink(), "Link to logs");
  html._(InfoBlock.class);
}
 
Example #11
Source File: HeaderBlock.java    From XLearning with Apache License 2.0 5 votes vote down vote up
protected void render(Block html) {
  String loggedIn = "";
  if (this.request().getRemoteUser() != null) {
    loggedIn = "Logged in as: " + this.request().getRemoteUser();
  }

  ((DIV) ((DIV) html.div("#header.ui-widget").div("#user")._(new Object[]{loggedIn})._()).div("#logo").img("/proxy/" + $(APP_ID) + "/static/xlWebApp/logo.png")._()).h1(this.$("title"))._();
}
 
Example #12
Source File: SingleCounterBlock.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override protected void render(Block html) {
  if (job == null) {
    html.
      p()._("Sorry, no counters for nonexistent", $(JOB_ID, "job"))._();
    return;
  }
  if (!$(TASK_ID).isEmpty() && task == null) {
    html.
      p()._("Sorry, no counters for nonexistent", $(TASK_ID, "task"))._();
    return;
  }
  
  String columnType = task == null ? "Task" : "Task Attempt";
  
  TBODY<TABLE<DIV<Hamlet>>> tbody = html.
    div(_INFO_WRAP).
    table("#singleCounter").
      thead().
        tr().
          th(".ui-state-default", columnType).
          th(".ui-state-default", "Value")._()._().
        tbody();
  for (Map.Entry<String, Long> entry : values.entrySet()) {
    TR<TBODY<TABLE<DIV<Hamlet>>>> row = tbody.tr();
    String id = entry.getKey();
    String val = entry.getValue().toString();
    if(task != null) {
      row.td(id);
      row.td().br().$title(val)._()._(val)._();
    } else {
      row.td().a(url("singletaskcounter",entry.getKey(),
          $(COUNTER_GROUP), $(COUNTER_NAME)), id)._();
      row.td().br().$title(val)._().a(url("singletaskcounter",entry.getKey(),
          $(COUNTER_GROUP), $(COUNTER_NAME)), val)._();
    }
    row._();
  }
  tbody._()._()._();
}
 
Example #13
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 #14
Source File: DefaultSchedulerPage.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void render(Block html) {
  html._(MetricsOverviewTable.class);
  UL<DIV<DIV<Hamlet>>> ul = html.
    div("#cs-wrapper.ui-widget").
      div(".ui-widget-header.ui-corner-top").
        _("FifoScheduler Queue")._().
      div("#cs.ui-widget-content.ui-corner-bottom").
        ul();

  if (fs == null) {
    ul.
      li().
        a(_Q).$style(width(WIDTH_F)).
          span().$style(Q_END)._("100% ")._().
          span(".q", "default")._()._();
  } else {
    float used = sinfo.getUsedCapacity();
    float set = sinfo.getCapacity();
    float delta = Math.abs(set - used) + 0.001f;
    ul.
      li().
        a(_Q).$style(width(WIDTH_F)).
          $title(join("used:", percent(used))).
          span().$style(Q_END)._("100%")._().
          span().$style(join(width(delta), ';', used > set ? OVER : UNDER,
            ';', used > set ? left(set) : left(used)))._(".")._().
          span(".q", sinfo.getQueueName())._().
        _(QueueInfoBlock.class)._();
  }

  ul._()._().
  script().$type("text/javascript").
      _("$('#cs').hide();")._()._().
  _(AppsBlock.class);
}
 
Example #15
Source File: ContainerPage.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
protected void render(Block html) {
  ContainerId containerID;
  try {
    containerID = ConverterUtils.toContainerId($(CONTAINER_ID));
  } catch (IllegalArgumentException e) {
    html.p()._("Invalid containerId " + $(CONTAINER_ID))._();
    return;
  }

  DIV<Hamlet> div = html.div("#content");
  Container container = this.nmContext.getContainers().get(containerID);
  if (container == null) {
    div.h1("Unknown Container. Container might have completed, "
            + "please go back to the previous page and retry.")._();
    return;
  }
  ContainerInfo info = new ContainerInfo(this.nmContext, container);

  info("Container information")
    ._("ContainerID", info.getId())
    ._("ContainerState", info.getState())
    ._("ExitStatus", info.getExitStatus())
    ._("Diagnostics", info.getDiagnostics())
    ._("User", info.getUser())
    ._("TotalMemoryNeeded", info.getMemoryNeeded())
    ._("TotalVCoresNeeded", info.getVCoresNeeded())
    ._("logs", info.getShortLogLink(), "Link to logs");
  html._(InfoBlock.class);
}
 
Example #16
Source File: HeaderBlock.java    From XLearning with Apache License 2.0 5 votes vote down vote up
protected void render(Block html) {
  String loggedIn = "";
  if (this.request().getRemoteUser() != null) {
    loggedIn = "Logged in as: " + this.request().getRemoteUser();
  }

  ((DIV) ((DIV) html.div("#header.ui-widget").div("#user")._(new Object[]{loggedIn})._()).div("#logo").img("/static/xlWebApp/logo.png")._()).h1(this.$("title"))._();
}
 
Example #17
Source File: NavBlock.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override protected void render(Block html) {
  String rmweb = $(RM_WEB);
  DIV<Hamlet> nav = html.
    div("#nav").
      h3("Cluster").
      ul().
        li().a(url(rmweb, "cluster", "cluster"), "About")._().
        li().a(url(rmweb, "cluster", "apps"), "Applications")._().
        li().a(url(rmweb, "cluster", "scheduler"), "Scheduler")._()._().
      h3("Application").
      ul().
        li().a(url("app/info"), "About")._().
        li().a(url("app"), "Jobs")._()._();
  if (app.getJob() != null) {
    String jobid = MRApps.toString(app.getJob().getID());
    List<AMInfo> amInfos = app.getJob().getAMInfos();
    AMInfo thisAmInfo = amInfos.get(amInfos.size()-1);
    String nodeHttpAddress = thisAmInfo.getNodeManagerHost() + ":" 
        + thisAmInfo.getNodeManagerHttpPort();
    nav.
      h3("Job").
      ul().
        li().a(url("job", jobid), "Overview")._().
        li().a(url("jobcounters", jobid), "Counters")._().
        li().a(url("conf", jobid), "Configuration")._().
        li().a(url("tasks", jobid, "m"), "Map tasks")._().
        li().a(url("tasks", jobid, "r"), "Reduce tasks")._().
        li().a(".logslink", url(MRWebAppUtil.getYARNWebappScheme(),
            nodeHttpAddress, "node",
            "containerlogs", thisAmInfo.getContainerId().toString(), 
            app.getJob().getUserName()), 
            "AM Logs")._()._();
    if (app.getTask() != null) {
      String taskid = MRApps.toString(app.getTask().getID());
      nav.
        h3("Task").
        ul().
          li().a(url("task", taskid), "Task Overview")._().
          li().a(url("taskcounters", taskid), "Counters")._()._();
    }
  }
  nav.
    h3("Tools").
    ul().
      li().a("/conf", "Configuration")._().
      li().a("/logs", "Local logs")._().
      li().a("/stacks", "Server stacks")._().
      li().a("/jmx?qry=Hadoop:*", "Server metrics")._()._()._();
}
 
Example #18
Source File: CountersBlock.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override protected void render(Block html) {
  if (job == null) {
    html.
      p()._("Sorry, no counters for nonexistent", $(JOB_ID, "job"))._();
    return;
  }
  if (!$(TASK_ID).isEmpty() && task == null) {
    html.
      p()._("Sorry, no counters for nonexistent", $(TASK_ID, "task"))._();
    return;
  }
  
  if(total == null || total.getGroupNames() == null || total.countCounters() == 0) {
    String type = $(TASK_ID);
    if(type == null || type.isEmpty()) {
      type = $(JOB_ID, "the job");
    }
    html.
      p()._("Sorry it looks like ",type," has no counters.")._();
    return;
  }
  
  String urlBase;
  String urlId;
  if(task != null) {
    urlBase = "singletaskcounter";
    urlId = MRApps.toString(task.getID());
  } else {
    urlBase = "singlejobcounter";
    urlId = MRApps.toString(job.getID());
  }
  
  
  int numGroups = 0;
  TBODY<TABLE<DIV<Hamlet>>> tbody = html.
    div(_INFO_WRAP).
    table("#counters").
      thead().
        tr().
          th(".group.ui-state-default", "Counter Group").
          th(".ui-state-default", "Counters")._()._().
      tbody();
  for (CounterGroup g : total) {
    CounterGroup mg = map == null ? null : map.getGroup(g.getName());
    CounterGroup rg = reduce == null ? null : reduce.getGroup(g.getName());
    ++numGroups;
    // This is mostly for demonstration :) Typically we'd introduced
    // a CounterGroup block to reduce the verbosity. OTOH, this
    // serves as an indicator of where we're in the tag hierarchy.
    TR<THEAD<TABLE<TD<TR<TBODY<TABLE<DIV<Hamlet>>>>>>>> groupHeadRow = tbody.
      tr().
        th().$title(g.getName()).$class("ui-state-default").
          _(fixGroupDisplayName(g.getDisplayName()))._().
        td().$class(C_TABLE).
          table(".dt-counters").$id(job.getID()+"."+g.getName()).
            thead().
              tr().th(".name", "Name");

    if (map != null) {
      groupHeadRow.th("Map").th("Reduce");
    }
    // Ditto
    TBODY<TABLE<TD<TR<TBODY<TABLE<DIV<Hamlet>>>>>>> group = groupHeadRow.
          th(map == null ? "Value" : "Total")._()._().
      tbody();
    for (Counter counter : g) {
      // Ditto
      TR<TBODY<TABLE<TD<TR<TBODY<TABLE<DIV<Hamlet>>>>>>>> groupRow = group.
        tr();
        if (task == null && mg == null && rg == null) {
          groupRow.td().$title(counter.getName())._(counter.getDisplayName()).
          _();
        } else {
          groupRow.td().$title(counter.getName()).
            a(url(urlBase,urlId,g.getName(), 
                counter.getName()), counter.getDisplayName()).
          _();
        }
      if (map != null) {
        Counter mc = mg == null ? null : mg.findCounter(counter.getName());
        Counter rc = rg == null ? null : rg.findCounter(counter.getName());
        groupRow.
          td(mc == null ? "0" : String.format("%,d", mc.getValue())).
          td(rc == null ? "0" : String.format("%,d", rc.getValue()));
      }
      groupRow.td(String.format("%,d", counter.getValue()))._();
    }
    group._()._()._()._();
  }
  tbody._()._()._();
}
 
Example #19
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 #20
Source File: FairSchedulerPage.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public void render(Block html) {
  html._(MetricsOverviewTable.class);
  UL<DIV<DIV<Hamlet>>> ul = html.
    div("#cs-wrapper.ui-widget").
      div(".ui-widget-header.ui-corner-top").
        _("Application Queues")._().
      div("#cs.ui-widget-content.ui-corner-bottom").
        ul();
  if (fs == null) {
    ul.
      li().
        a(_Q).$style(width(Q_MAX_WIDTH)).
          span().$style(Q_END)._("100% ")._().
          span(".q", "default")._()._();
  } else {
    FairSchedulerInfo sinfo = new FairSchedulerInfo(fs);
    fsqinfo.qinfo = sinfo.getRootQueueInfo();
    float used = fsqinfo.qinfo.getUsedMemoryFraction();

    ul.
      li().$style("margin-bottom: 1em").
        span().$style("font-weight: bold")._("Legend:")._().
        span().$class("qlegend ui-corner-all").$style(Q_GIVEN).
          $title("The steady fair shares consider all queues, " +
              "both active (with running applications) and inactive.").
          _(STEADY_FAIR_SHARE)._().
        span().$class("qlegend ui-corner-all").$style(Q_INSTANTANEOUS_FS).
          $title("The instantaneous fair shares consider only active " +
              "queues (with running applications).").
          _(INSTANTANEOUS_FAIR_SHARE)._().
        span().$class("qlegend ui-corner-all").$style(Q_UNDER).
          _("Used")._().
        span().$class("qlegend ui-corner-all").$style(Q_OVER).
          _("Used (over fair share)")._().
        span().$class("qlegend ui-corner-all ui-state-default").
          _("Max Capacity")._().
    _().
      li().
        a(_Q).$style(width(Q_MAX_WIDTH)).
          span().$style(join(width(used), ";left:0%;",
              used > 1 ? Q_OVER : Q_UNDER))._(".")._().
          span(".q", "root")._().
        span().$class("qstats").$style(left(Q_STATS_POS)).
          _(join(percent(used), " used"))._().
        _(QueueBlock.class)._();
  }
  ul._()._().
  script().$type("text/javascript").
      _("$('#cs').hide();")._()._().
  _(FairSchedulerAppsBlock.class);
}
 
Example #21
Source File: CapacitySchedulerPage.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public void render(Block html) {
  html._(MetricsOverviewTable.class);
  UL<DIV<DIV<Hamlet>>> ul = html.
    div("#cs-wrapper.ui-widget").
      div(".ui-widget-header.ui-corner-top").
        _("Application Queues")._().
      div("#cs.ui-widget-content.ui-corner-bottom").
        ul();
  if (cs == null) {
    ul.
      li().
        a(_Q).$style(width(Q_MAX_WIDTH)).
          span().$style(Q_END)._("100% ")._().
          span(".q", "default")._()._();
  } else {
    CSQueue root = cs.getRootQueue();
    CapacitySchedulerInfo sinfo = new CapacitySchedulerInfo(root);
    csqinfo.csinfo = sinfo;
    csqinfo.qinfo = null;

    float used = sinfo.getUsedCapacity() / 100;
    ul.
      li().$style("margin-bottom: 1em").
        span().$style("font-weight: bold")._("Legend:")._().
        span().$class("qlegend ui-corner-all").$style(Q_GIVEN).
          _("Capacity")._().
        span().$class("qlegend ui-corner-all").$style(Q_UNDER).
          _("Used")._().
        span().$class("qlegend ui-corner-all").$style(Q_OVER).
          _("Used (over capacity)")._().
        span().$class("qlegend ui-corner-all ui-state-default").
          _("Max Capacity")._().
      _().
      li().
        a(_Q).$style(width(Q_MAX_WIDTH)).
          span().$style(join(width(used), ";left:0%;",
              used > 1 ? Q_OVER : Q_UNDER))._(".")._().
          span(".q", "root")._().
        span().$class("qstats").$style(left(Q_STATS_POS)).
          _(join(percent(used), " used"))._().
        _(QueueBlock.class)._();
  }
  ul._()._().
  script().$type("text/javascript").
      _("$('#cs').hide();")._()._().
  _(AppsBlock.class);
}
 
Example #22
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 #23
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 #24
Source File: FairSchedulerPage.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public void render(Block html) {
  html._(MetricsOverviewTable.class);
  UL<DIV<DIV<Hamlet>>> ul = html.
    div("#cs-wrapper.ui-widget").
      div(".ui-widget-header.ui-corner-top").
        _("Application Queues")._().
      div("#cs.ui-widget-content.ui-corner-bottom").
        ul();
  if (fs == null) {
    ul.
      li().
        a(_Q).$style(width(Q_MAX_WIDTH)).
          span().$style(Q_END)._("100% ")._().
          span(".q", "default")._()._();
  } else {
    FairSchedulerInfo sinfo = new FairSchedulerInfo(fs);
    fsqinfo.qinfo = sinfo.getRootQueueInfo();
    float used = fsqinfo.qinfo.getUsedMemoryFraction();

    ul.
      li().$style("margin-bottom: 1em").
        span().$style("font-weight: bold")._("Legend:")._().
        span().$class("qlegend ui-corner-all").$style(Q_GIVEN).
          $title("The steady fair shares consider all queues, " +
              "both active (with running applications) and inactive.").
          _(STEADY_FAIR_SHARE)._().
        span().$class("qlegend ui-corner-all").$style(Q_INSTANTANEOUS_FS).
          $title("The instantaneous fair shares consider only active " +
              "queues (with running applications).").
          _(INSTANTANEOUS_FAIR_SHARE)._().
        span().$class("qlegend ui-corner-all").$style(Q_UNDER).
          _("Used")._().
        span().$class("qlegend ui-corner-all").$style(Q_OVER).
          _("Used (over fair share)")._().
        span().$class("qlegend ui-corner-all ui-state-default").
          _("Max Capacity")._().
    _().
      li().
        a(_Q).$style(width(Q_MAX_WIDTH)).
          span().$style(join(width(used), ";left:0%;",
              used > 1 ? Q_OVER : Q_UNDER))._(".")._().
          span(".q", "root")._().
        span().$class("qstats").$style(left(Q_STATS_POS)).
          _(join(percent(used), " used"))._().
        _(QueueBlock.class)._();
  }
  ul._()._().
  script().$type("text/javascript").
      _("$('#cs').hide();")._()._().
  _(FairSchedulerAppsBlock.class);
}
 
Example #25
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._();
}
 
Example #26
Source File: NavBlock.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override protected void render(Block html) {
  String rmweb = $(RM_WEB);
  DIV<Hamlet> nav = html.
    div("#nav").
      h3("Cluster").
      ul().
        li().a(url(rmweb, "cluster", "cluster"), "About")._().
        li().a(url(rmweb, "cluster", "apps"), "Applications")._().
        li().a(url(rmweb, "cluster", "scheduler"), "Scheduler")._()._().
      h3("Application").
      ul().
        li().a(url("app/info"), "About")._().
        li().a(url("app"), "Jobs")._()._();
  if (app.getJob() != null) {
    String jobid = MRApps.toString(app.getJob().getID());
    List<AMInfo> amInfos = app.getJob().getAMInfos();
    AMInfo thisAmInfo = amInfos.get(amInfos.size()-1);
    String nodeHttpAddress = thisAmInfo.getNodeManagerHost() + ":" 
        + thisAmInfo.getNodeManagerHttpPort();
    nav.
      h3("Job").
      ul().
        li().a(url("job", jobid), "Overview")._().
        li().a(url("jobcounters", jobid), "Counters")._().
        li().a(url("conf", jobid), "Configuration")._().
        li().a(url("tasks", jobid, "m"), "Map tasks")._().
        li().a(url("tasks", jobid, "r"), "Reduce tasks")._().
        li().a(".logslink", url(MRWebAppUtil.getYARNWebappScheme(),
            nodeHttpAddress, "node",
            "containerlogs", thisAmInfo.getContainerId().toString(), 
            app.getJob().getUserName()), 
            "AM Logs")._()._();
    if (app.getTask() != null) {
      String taskid = MRApps.toString(app.getTask().getID());
      nav.
        h3("Task").
        ul().
          li().a(url("task", taskid), "Task Overview")._().
          li().a(url("taskcounters", taskid), "Counters")._()._();
    }
  }
  nav.
    h3("Tools").
    ul().
      li().a("/conf", "Configuration")._().
      li().a("/logs", "Local logs")._().
      li().a("/stacks", "Server stacks")._().
      li().a("/jmx?qry=Hadoop:*", "Server metrics")._()._()._();
}
 
Example #27
Source File: CountersBlock.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override protected void render(Block html) {
  if (job == null) {
    html.
      p()._("Sorry, no counters for nonexistent", $(JOB_ID, "job"))._();
    return;
  }
  if (!$(TASK_ID).isEmpty() && task == null) {
    html.
      p()._("Sorry, no counters for nonexistent", $(TASK_ID, "task"))._();
    return;
  }
  
  if(total == null || total.getGroupNames() == null || total.countCounters() == 0) {
    String type = $(TASK_ID);
    if(type == null || type.isEmpty()) {
      type = $(JOB_ID, "the job");
    }
    html.
      p()._("Sorry it looks like ",type," has no counters.")._();
    return;
  }
  
  String urlBase;
  String urlId;
  if(task != null) {
    urlBase = "singletaskcounter";
    urlId = MRApps.toString(task.getID());
  } else {
    urlBase = "singlejobcounter";
    urlId = MRApps.toString(job.getID());
  }
  
  
  int numGroups = 0;
  TBODY<TABLE<DIV<Hamlet>>> tbody = html.
    div(_INFO_WRAP).
    table("#counters").
      thead().
        tr().
          th(".group.ui-state-default", "Counter Group").
          th(".ui-state-default", "Counters")._()._().
      tbody();
  for (CounterGroup g : total) {
    CounterGroup mg = map == null ? null : map.getGroup(g.getName());
    CounterGroup rg = reduce == null ? null : reduce.getGroup(g.getName());
    ++numGroups;
    // This is mostly for demonstration :) Typically we'd introduced
    // a CounterGroup block to reduce the verbosity. OTOH, this
    // serves as an indicator of where we're in the tag hierarchy.
    TR<THEAD<TABLE<TD<TR<TBODY<TABLE<DIV<Hamlet>>>>>>>> groupHeadRow = tbody.
      tr().
        th().$title(g.getName()).$class("ui-state-default").
          _(fixGroupDisplayName(g.getDisplayName()))._().
        td().$class(C_TABLE).
          table(".dt-counters").$id(job.getID()+"."+g.getName()).
            thead().
              tr().th(".name", "Name");

    if (map != null) {
      groupHeadRow.th("Map").th("Reduce");
    }
    // Ditto
    TBODY<TABLE<TD<TR<TBODY<TABLE<DIV<Hamlet>>>>>>> group = groupHeadRow.
          th(map == null ? "Value" : "Total")._()._().
      tbody();
    for (Counter counter : g) {
      // Ditto
      TR<TBODY<TABLE<TD<TR<TBODY<TABLE<DIV<Hamlet>>>>>>>> groupRow = group.
        tr();
        if (task == null && mg == null && rg == null) {
          groupRow.td().$title(counter.getName())._(counter.getDisplayName()).
          _();
        } else {
          groupRow.td().$title(counter.getName()).
            a(url(urlBase,urlId,g.getName(), 
                counter.getName()), counter.getDisplayName()).
          _();
        }
      if (map != null) {
        Counter mc = mg == null ? null : mg.findCounter(counter.getName());
        Counter rc = rg == null ? null : rg.findCounter(counter.getName());
        groupRow.
          td(mc == null ? "0" : String.format("%,d", mc.getValue())).
          td(rc == null ? "0" : String.format("%,d", rc.getValue()));
      }
      groupRow.td(String.format("%,d", counter.getValue()))._();
    }
    group._()._()._()._();
  }
  tbody._()._()._();
}