Java Code Examples for org.apache.hadoop.mapreduce.v2.app.job.Task#getCounters()

The following examples show how to use org.apache.hadoop.mapreduce.v2.app.job.Task#getCounters() . 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: JobImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Private
public void constructFinalFullcounters() {
  this.fullCounters = new Counters();
  this.finalMapCounters = new Counters();
  this.finalReduceCounters = new Counters();
  this.fullCounters.incrAllCounters(jobCounters);
  for (Task t : this.tasks.values()) {
    Counters counters = t.getCounters();
    switch (t.getType()) {
    case MAP:
      this.finalMapCounters.incrAllCounters(counters);
      break;
    case REDUCE:
      this.finalReduceCounters.incrAllCounters(counters);
      break;
    default:
      throw new IllegalStateException("Task type neither map nor reduce: " + 
          t.getType());
    }
    this.fullCounters.incrAllCounters(counters);
  }
}
 
Example 2
Source File: JobImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Private
public void constructFinalFullcounters() {
  this.fullCounters = new Counters();
  this.finalMapCounters = new Counters();
  this.finalReduceCounters = new Counters();
  this.fullCounters.incrAllCounters(jobCounters);
  for (Task t : this.tasks.values()) {
    Counters counters = t.getCounters();
    switch (t.getType()) {
    case MAP:
      this.finalMapCounters.incrAllCounters(counters);
      break;
    case REDUCE:
      this.finalReduceCounters.incrAllCounters(counters);
      break;
    default:
      throw new IllegalStateException("Task type neither map nor reduce: " + 
          t.getType());
    }
    this.fullCounters.incrAllCounters(counters);
  }
}
 
Example 3
Source File: JobTaskCounterInfo.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public JobTaskCounterInfo(Task task) {
  total = task.getCounters();
  this.id = MRApps.toString(task.getID());
  taskCounterGroup = new ArrayList<TaskCounterGroupInfo>();
  if (total != null) {
    for (CounterGroup g : total) {
      if (g != null) {
        TaskCounterGroupInfo cginfo = new TaskCounterGroupInfo(g.getName(), g);
        taskCounterGroup.add(cginfo);
      }
    }
  }
}
 
Example 4
Source File: MockJobs.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static Counters getCounters(
    Collection<Task> tasks) {
  List<Task> completedTasks = new ArrayList<Task>();
  for (Task task : tasks) {
    if (task.getCounters() != null) {
      completedTasks.add(task);
    }
  }
  Counters counters = new Counters();
  return JobImpl.incrTaskCounters(counters, completedTasks);
}
 
Example 5
Source File: JobTaskCounterInfo.java    From big-c with Apache License 2.0 5 votes vote down vote up
public JobTaskCounterInfo(Task task) {
  total = task.getCounters();
  this.id = MRApps.toString(task.getID());
  taskCounterGroup = new ArrayList<TaskCounterGroupInfo>();
  if (total != null) {
    for (CounterGroup g : total) {
      if (g != null) {
        TaskCounterGroupInfo cginfo = new TaskCounterGroupInfo(g.getName(), g);
        taskCounterGroup.add(cginfo);
      }
    }
  }
}
 
Example 6
Source File: MockJobs.java    From big-c with Apache License 2.0 5 votes vote down vote up
public static Counters getCounters(
    Collection<Task> tasks) {
  List<Task> completedTasks = new ArrayList<Task>();
  for (Task task : tasks) {
    if (task.getCounters() != null) {
      completedTasks.add(task);
    }
  }
  Counters counters = new Counters();
  return JobImpl.incrTaskCounters(counters, completedTasks);
}