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

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

  readLock.lock();

  try {
    DAGState state = getInternalState();
    if (state == DAGState.ERROR || state == DAGState.FAILED
        || state == DAGState.KILLED || state == DAGState.SUCCEEDED) {
      this.mayBeConstructFinalFullCounters();
      return fullCounters;
    }

    TezCounters counters = new TezCounters();
    counters.incrAllCounters(dagCounters);
    return incrTaskCounters(counters, vertices.values());

  } finally {
    readLock.unlock();
  }
}
 
Example 2
Source File: DAGImpl.java    From tez with Apache License 2.0 6 votes vote down vote up
@Override
public TezCounters getAllCounters() {

  readLock.lock();

  try {
    DAGState state = getInternalState();
    if (state == DAGState.ERROR || state == DAGState.FAILED
        || state == DAGState.KILLED || state == DAGState.SUCCEEDED) {
      this.mayBeConstructFinalFullCounters();
      return fullCounters;
    }

    // dag not yet finished. update cpu time counters
    updateCpuCounters();
    TezCounters counters = new TezCounters();
    counters.incrAllCounters(dagCounters);
    return aggrTaskCounters(counters, vertices.values());

  } finally {
    readLock.unlock();
  }
}
 
Example 3
Source File: DAGImpl.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
public static TezCounters incrTaskCounters(
    TezCounters counters, Collection<Vertex> vertices) {
  for (Vertex vertex : vertices) {
    counters.incrAllCounters(vertex.getAllCounters());
  }
  return counters;
}
 
Example 4
Source File: VertexImpl.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
public static TezCounters incrTaskCounters(
    TezCounters counters, Collection<Task> tasks) {
  for (Task task : tasks) {
    counters.incrAllCounters(task.getCounters());
  }
  return counters;
}
 
Example 5
Source File: DAGImpl.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;
    }

    // dag not yet finished. update cpu time counters
    updateCpuCounters();
    TezCounters counters = new TezCounters();
    counters.incrAllCounters(dagCounters);
    return aggrTaskCounters(counters, vertices.values());

  } finally {
    readLock.unlock();
  }
}
 
Example 6
Source File: TaskImpl.java    From tez with Apache License 2.0 5 votes vote down vote up
@Override
public TezCounters getCounters() {
  TezCounters counters = new TezCounters();
  counters.incrAllCounters(this.counters);
  readLock.lock();
  try {
    TaskAttempt bestAttempt = selectBestAttempt();
    if (bestAttempt != null) {
      counters.incrAllCounters(bestAttempt.getCounters());
    }
    return counters;
  } finally {
    readLock.unlock();
  }
}
 
Example 7
Source File: RuntimeTask.java    From tez with Apache License 2.0 5 votes vote down vote up
public TezCounters getCounters() {
  TezCounters fullCounters = new TezCounters();
  fullCounters.incrAllCounters(tezCounters);
  for (TezCounters counter : counterMap.values()) {
    fullCounters.incrAllCounters(counter);
  }
  return fullCounters;
}