Package org.apache.hadoop.mapreduce

Examples of org.apache.hadoop.mapreduce.CounterGroup


  } 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

  }

  static Counters fromAvro(JhCounters counters) {
    Counters result = new Counters();
    for (JhCounterGroup g : counters.groups) {
      CounterGroup group =
        new CounterGroup(g.name.toString(), g.displayName.toString());
      for (JhCounter c : g.counts) {
        group.addCounter(new Counter(c.name.toString(),
                                     c.displayName.toString(),
                                     c.value));
      }
      result.addGroup(group);
    }
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

    final ReduceDriver<EmitKey, EmitValue, Text, NullWritable> reduceDriver = new ReduceDriver<EmitKey, EmitValue, Text, NullWritable>(
        new MrcounterSizzleReducer());
    reduceDriver.setInput(new EmitKey("test"), values);
    reduceDriver.runTest();
    final Counters counters = reduceDriver.getCounters();
    final CounterGroup group = counters.getGroup("test[]");

    Assert.assertEquals("counter value is wrong", 0, group.findCounter("one").getValue());
    Assert.assertEquals("counter value is wrong", 0, group.findCounter("two").getValue());
    Assert.assertEquals("counter value is wrong", 0, group.findCounter("three").getValue());
    Assert.assertEquals("counter value is wrong", 0, group.findCounter("four").getValue());
  }
View Full Code Here

    final ReduceDriver<EmitKey, EmitValue, EmitKey, EmitValue> reduceDriver = new ReduceDriver<EmitKey, EmitValue, EmitKey, EmitValue>(
        new MrcounterSizzleCombiner());
    reduceDriver.setInput(new EmitKey("test"), values);
    reduceDriver.runTest();
    final Counters counters = reduceDriver.getCounters();
    final CounterGroup group = counters.getGroup("Sizzle Counters");

    Assert.assertEquals("counter value is wrong", 3, group.findCounter("Unnamed counter").getValue());
  }
View Full Code Here

    final ReduceDriver<EmitKey, EmitValue, EmitKey, EmitValue> reduceDriver = new ReduceDriver<EmitKey, EmitValue, EmitKey, EmitValue>(
        new MrcounterSizzleCombiner());
    reduceDriver.setInput(new EmitKey("[three]", "test"), values);
    reduceDriver.runTest();
    final Counters counters = reduceDriver.getCounters();
    final CounterGroup group = counters.getGroup("Sizzle Counters");

    Assert.assertEquals("counter value is wrong", 3, group.findCounter("three").getValue());
  }
View Full Code Here

    final ReduceDriver<EmitKey, EmitValue, EmitKey, EmitValue> reduceDriver = new ReduceDriver<EmitKey, EmitValue, EmitKey, EmitValue>(
        new MrcounterSizzleCombiner());
    reduceDriver.setInput(new EmitKey("[Job Statistics][Some counter]", "test"), values);
    reduceDriver.runTest();
    final Counters counters = reduceDriver.getCounters();
    final CounterGroup group = counters.getGroup("Job Statistics");

    Assert.assertEquals("counter value is wrong", 3, group.findCounter("Some counter").getValue());
  }
View Full Code Here

    final ReduceDriver<EmitKey, EmitValue, EmitKey, EmitValue> reduceDriver = new ReduceDriver<EmitKey, EmitValue, EmitKey, EmitValue>(
        new MrcounterSizzleCombiner());
    reduceDriver.setInput(new EmitKey("[Job Statistics][Some][counter]", "test"), values);
    reduceDriver.runTest();
    final Counters counters = reduceDriver.getCounters();
    final CounterGroup group = counters.getGroup("Job Statistics");

    Assert.assertEquals("counter value is wrong", 3, group.findCounter("Somecounter").getValue());
  }
View Full Code Here

  }

  static Counters fromAvro(JhCounters counters) {
    Counters result = new Counters();
    for (JhCounterGroup g : counters.groups) {
      CounterGroup group =
          result.addGroup(StringInterner.weakIntern(g.name.toString()),
              StringInterner.weakIntern(g.displayName.toString()));
      for (JhCounter c : g.counts) {
        group.addCounter(StringInterner.weakIntern(c.name.toString()),
            StringInterner.weakIntern(c.displayName.toString()), c.value);
      }
    }
    return result;
  }
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.