Java Code Examples for org.apache.tez.common.counters.TezCounters#aggrAllCounters()

The following examples show how to use org.apache.tez.common.counters.TezCounters#aggrAllCounters() . 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: VertexImpl.java    From tez with Apache License 2.0 6 votes vote down vote up
@Override
public TezCounters getAllCounters() {

  readLock.lock();

  try {
    if (inTerminalState()) {
      this.mayBeConstructFinalFullCounters();
      return fullCounters;
    }

    TezCounters counters = new TezCounters();
    counters.aggrAllCounters(this.counters);
    return aggrTaskCounters(counters, tasks.values());

  } finally {
    readLock.unlock();
  }
}
 
Example 2
Source File: DAGImpl.java    From tez with Apache License 2.0 5 votes vote down vote up
public static TezCounters aggrTaskCounters(
    TezCounters counters, Collection<Vertex> vertices) {
  for (Vertex vertex : vertices) {
    counters.aggrAllCounters(vertex.getAllCounters());
  }
  return counters;
}
 
Example 3
Source File: VertexImpl.java    From tez with Apache License 2.0 5 votes vote down vote up
@Override
public TezCounters getCachedCounters() {
  readLock.lock();

  try {
    // FIXME a better lightweight approach for counters is needed
    if (fullCounters == null && cachedCounters != null
        && ((cachedCountersTimestamp+10000) > System.currentTimeMillis())) {
      LOG.info("Asked for counters"
          + ", cachedCountersTimestamp=" + cachedCountersTimestamp
          + ", currentTime=" + System.currentTimeMillis());
      return cachedCounters;
    }

    cachedCountersTimestamp = System.currentTimeMillis();
    if (inTerminalState()) {
      this.mayBeConstructFinalFullCounters();
      return fullCounters;
    }

    TezCounters counters = new TezCounters();
    counters.aggrAllCounters(this.counters);
    cachedCounters = aggrTaskCounters(counters, tasks.values());
    return cachedCounters;
  } finally {
    readLock.unlock();
  }
}
 
Example 4
Source File: VertexImpl.java    From tez with Apache License 2.0 5 votes vote down vote up
public static TezCounters aggrTaskCounters(
    TezCounters counters, Collection<Task> tasks) {
  for (Task task : tasks) {
    counters.aggrAllCounters(task.getCounters());
  }
  return counters;
}