Package org.apache.hadoop.mapreduce

Examples of org.apache.hadoop.mapreduce.CounterGroup


          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").
              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.valueOf(mc.getValue())).
            td(rc == null ? "0" : String.valueOf(rc.getValue()));
        }
        groupRow.td(String.valueOf(counter.getValue()))._();
View Full Code Here


    this.id = MRApps.toString(job.getID());

    if (total != null) {
      for (CounterGroup g : total) {
        if (g != null) {
          CounterGroup mg = map == null ? null : map.getGroup(g.getName());
          CounterGroup rg = reduce == null ? null : reduce
            .getGroup(g.getName());

          CounterGroupInfo cginfo = new CounterGroupInfo(g.getName(), g,
            mg, rg);
          counterGroup.add(cginfo);
View Full Code Here

        "Reduce Value",
        "Total Value"));
    buff.append("\n------------------------------------------"+
        "---------------------------------------------");
    for (String groupName : totalCounters.getGroupNames()) {
         CounterGroup totalGroup = totalCounters.getGroup(groupName);
         CounterGroup mapGroup = mapCounters.getGroup(groupName);
         CounterGroup reduceGroup = reduceCounters.getGroup(groupName);
     
         Format decimal = new DecimalFormat();
         Iterator<org.apache.hadoop.mapreduce.Counter> ctrItr =
           totalGroup.iterator();
         while(ctrItr.hasNext()) {
           org.apache.hadoop.mapreduce.Counter counter = ctrItr.next();
           String name = counter.getName();
           String mapValue =
             decimal.format(mapGroup.findCounter(name).getValue());
           String reduceValue =
             decimal.format(reduceGroup.findCounter(name).getValue());
           String totalValue =
             decimal.format(counter.getValue());

           buff.append(
               String.format("%n|%1$-30s|%2$-30s|%3$-10s|%4$-10s|%5$-10s",
View Full Code Here

    protected void handleFailure(Counters counters) throws IOException {
      Configuration conf = job.getConfiguration();
      HConnection conn = HConnectionManager.getConnection(conf);
      TableName tableName = getTableName(conf);
      CounterGroup g = counters.getGroup("undef");
      Iterator<Counter> it = g.iterator();
      while (it.hasNext()) {
        String keyString = it.next().getName();
        byte[] key = Bytes.toBytes(keyString);
        HRegionLocation loc = conn.relocateRegion(tableName, key);
        LOG.error("undefined row " + keyString + ", " + loc);
      }
      g = counters.getGroup("unref");
      it = g.iterator();
      while (it.hasNext()) {
        String keyString = it.next().getName();
        byte[] key = Bytes.toBytes(keyString);
        HRegionLocation loc = conn.relocateRegion(tableName, key);
        LOG.error("unreferred row " + keyString + ", " + loc);
View Full Code Here

    @Override
    protected void handleFailure(Counters counters) throws IOException {
      Configuration conf = job.getConfiguration();
      HConnection conn = HConnectionManager.getConnection(conf);
      TableName tableName = TableName.valueOf(COMMON_TABLE_NAME);
      CounterGroup g = counters.getGroup("undef");
      Iterator<Counter> it = g.iterator();
      while (it.hasNext()) {
        String keyString = it.next().getName();
        byte[] key = Bytes.toBytes(keyString);
        HRegionLocation loc = conn.relocateRegion(tableName, key);
        LOG.error("undefined row " + keyString + ", " + loc);
      }
      g = counters.getGroup("unref");
      it = g.iterator();
      while (it.hasNext()) {
        String keyString = it.next().getName();
        byte[] key = Bytes.toBytes(keyString);
        HRegionLocation loc = conn.relocateRegion(tableName, key);
        LOG.error("unreferred row " + keyString + ", " + loc);
View Full Code Here

  } else {   

      out.write("\n    <table>\n");

      for (String groupName : counters.getGroupNames()) {
        CounterGroup group = counters.getGroup(groupName);
        String displayGroupName = group.getDisplayName();

      out.write("\n        <tr>\n          <td colspan=\"3\"><br/><b>\n          ");
      out.print(HtmlQuoting.quoteHtmlChars(displayGroupName));
      out.write("</b></td>\n        </tr>\n");

        Iterator<Counter> ctrItr = group.iterator();
        while(ctrItr.hasNext()) {
          Counter counter = ctrItr.next();
          String displayCounterName = counter.getDisplayName();
          long value = counter.getValue();
View Full Code Here

Counters mapCounters = job.getMapCounters();
Counters reduceCounters = job.getReduceCounters();

if (totalCounters != null) {
   for (String groupName : totalCounters.getGroupNames()) {
     CounterGroup totalGroup = totalCounters.getGroup(groupName);
     CounterGroup mapGroup = mapCounters.getGroup(groupName);
     CounterGroup reduceGroup = reduceCounters.getGroup(groupName);
 
     Format decimal = new DecimalFormat();
 
     boolean isFirst = true;
     Iterator<Counter> ctrItr = totalGroup.iterator();
     while(ctrItr.hasNext()) {
       Counter counter = ctrItr.next();
       String name = counter.getName();
       String mapValue =
        decimal.format(mapGroup.findCounter(name).getValue());
       String reduceValue =
        decimal.format(reduceGroup.findCounter(name).getValue());
       String totalValue =
        decimal.format(counter.getValue());

      out.write("\n       <tr>\n");
View Full Code Here

      count++;
    }
    reader.close();
    assertFalse(count == 0);

    CounterGroup counters =
      job.getCounters().getGroup(MultipleOutputs.class.getName());
    if (!withCounters) {
      assertEquals(0, counters.size());
    }
    else {
      assertEquals(1, counters.size());
      assertEquals(4, counters.findCounter("text").getValue());
    }

  }
View Full Code Here

      if (!success) {
        Configuration conf = job.getConfiguration();
        HConnection conn = HConnectionManager.getConnection(conf);
        TableName tableName = getTableName(conf);
        CounterGroup g = counters.getGroup("undef");
        Iterator<Counter> it = g.iterator();
        while (it.hasNext()) {
          String keyString = it.next().getName();
          byte[] key = Bytes.toBytes(keyString);
          HRegionLocation loc = conn.relocateRegion(tableName, key);
          LOG.error("undefined row " + keyString + ", " + loc);
        }
        g = counters.getGroup("unref");
        it = g.iterator();
        while (it.hasNext()) {
          String keyString = it.next().getName();
          byte[] key = Bytes.toBytes(keyString);
          HRegionLocation loc = conn.relocateRegion(tableName, key);
          LOG.error("unreferred row " + keyString + ", " + loc);
View Full Code Here


  private long getCounterValue(Counters counters, String key)
     throws ParseException {
    for (String groupName : counters.getGroupNames()) {
       CounterGroup totalGroup = counters.getGroup(groupName);
       Iterator<Counter> itrCounter = totalGroup.iterator();
       while (itrCounter.hasNext()) {
         Counter counter = itrCounter.next();
         if (counter.getName().equals(key)) {
           return counter.getValue();
         }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.mapreduce.CounterGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.