@Override public void addCounters(final TezCounters tezCounters) { counters.incrAllCounters(tezCounters); }
public TezCounters getCounters() { TezCounters fullCounters = new TezCounters(); fullCounters.incrAllCounters(tezCounters); for (TezCounters counter : counterMap.values()) { fullCounters.incrAllCounters(counter); } return fullCounters; }
public static TezCounters incrTaskCounters( TezCounters counters, Collection<Vertex> vertices) { for (Vertex vertex : vertices) { counters.incrAllCounters(vertex.getAllCounters()); } return counters; }
public static TezCounters incrTaskCounters( TezCounters counters, Collection<Task> tasks) { for (Task task : tasks) { counters.incrAllCounters(task.getCounters()); } return counters; }
@Private public void constructFinalFullcounters() { this.fullCounters = new TezCounters(); this.fullCounters.incrAllCounters(dagCounters); for (Vertex v : this.vertices.values()) { this.fullCounters.incrAllCounters(v.getAllCounters()); } }
@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(); } }
@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.incrAllCounters(this.counters); cachedCounters = incrTaskCounters(counters, tasks.values()); return cachedCounters; } finally { readLock.unlock(); } }
@Override public TezCounters getAllCounters() { readLock.lock(); try { if (inTerminalState()) { this.mayBeConstructFinalFullCounters(); return fullCounters; } TezCounters counters = new TezCounters(); counters.incrAllCounters(this.counters); return incrTaskCounters(counters, tasks.values()); } finally { readLock.unlock(); } }
@Private public void constructFinalFullcounters() { this.fullCounters = new TezCounters(); this.fullCounters.incrAllCounters(counters); this.vertexStats = new VertexStats(); for (Task t : this.tasks.values()) { vertexStats.updateStats(t.getReport()); TezCounters counters = t.getCounters(); this.fullCounters.incrAllCounters(counters); } }
@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 incrTaskCounters(counters, vertices.values()); } finally { readLock.unlock(); } }
@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 incrTaskCounters(counters, vertices.values()); } finally { readLock.unlock(); } }