Package org.apache.hadoop.mapreduce

Examples of org.apache.hadoop.mapreduce.CounterGroup


    executionContext.put(statusPrefix + "Name", job.getJobName());
    executionContext.put(statusPrefix + "Tracking URL", job.getTrackingURL());
    executionContext.put(statusPrefix + "State", JobUtils.getStatus(job).toString());
    try {
      for (String cgName : job.getCounters().getGroupNames()) {
        CounterGroup group = job.getCounters().getGroup(cgName);
        Iterator<Counter> ci = group.iterator();
        while (ci.hasNext()) {
          Counter c = ci.next();
          executionContext.put(group.getDisplayName().trim() + "::" + c.getDisplayName().trim(), c.getValue());
        }
      }
    } catch (Exception ignore) {}
  }
View Full Code Here


        job.setOutputFormatClass(AccumuloElementOutputFormat.class);
        FileInputFormat.addInputPath(job, new Path(conf.get("in")));

        int returnCode = job.waitForCompletion(true) ? 0 : 1;

        CounterGroup groupCounters = job.getCounters().getGroup(GDELTImportCounters.class.getName());
        for (Counter counter : groupCounters) {
            System.out.println(counter.getDisplayName() + ": " + counter.getValue());
        }

        return returnCode;
View Full Code Here

        job.setOutputFormatClass(AccumuloElementOutputFormat.class);
        FileInputFormat.addInputPath(job, new Path(conf.get("in")));

        int returnCode = job.waitForCompletion(true) ? 0 : 1;

        CounterGroup groupCounters = job.getCounters().getGroup(FriendsterImportCounters.class.getName());
        for (Counter counter : groupCounters) {
            System.out.println(counter.getDisplayName() + ": " + counter.getValue());
        }

        return returnCode;
View Full Code Here

    protected void printCounters(Job job) {
        try {
            LOGGER.info("Counters");
            for (String groupName : job.getCounters().getGroupNames()) {
                CounterGroup groupCounters = job.getCounters().getGroup(groupName);
                LOGGER.info(groupCounters.getDisplayName());
                for (Counter counter : groupCounters) {
                    LOGGER.info("  " + counter.getDisplayName() + ": " + counter.getValue());
                }
            }
        } catch (IOException ex) {
View Full Code Here

  private Counters getCounters() {
    Counters c = new Counters();
    Map<String, Map<String, Long>> values = counters.value();
    for (Map.Entry<String, Map<String, Long>> e : values.entrySet()) {
      CounterGroup cg = c.getGroup(e.getKey());
      for (Map.Entry<String, Long> f : e.getValue().entrySet()) {
        cg.findCounter(f.getKey()).setValue(f.getValue());
      }
    }
    return c;
  }
View Full Code Here

  static Counters fromAvro(JhCounters counters) {
    Counters result = new Counters();
    if(counters != null) {
      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

        final Group group = mapred.getGroup(groupName);
        collectCounters(counters, groupName, group.iterator());
      }
    } else {
      for (String groupName : groupNames) {
        final CounterGroup group = mapreduce.getGroup(groupName);
        collectCounters(counters, groupName, group.iterator());
      }
    }
    return counters;
  }
View Full Code Here

  }

  private Counters getCounters() {
    Counters c = new Counters();
    for (Map.Entry<String, Map<String, Long>> e : counters.value().entrySet()) {
      CounterGroup cg = c.getGroup(e.getKey());
      for (Map.Entry<String, Long> f : e.getValue().entrySet()) {
        cg.findCounter(f.getKey()).setValue(f.getValue());
      }
    }
    return c;
  }
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

        final Group group = mapred.getGroup(groupName);
        collectCounters(counters, groupName, group.iterator());
      }
    } else {
      for (String groupName : groupNames) {
        final CounterGroup group = mapreduce.getGroup(groupName);
        collectCounters(counters, groupName, group.iterator());
      }
    }
    return counters;
  }
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.