use of org.apache.tez.common.counters.TezCounters in project tez by apache.
the class VertexImpl method getAllCounters.
@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();
}
}
use of org.apache.tez.common.counters.TezCounters in project tez by apache.
the class TaskAttemptImpl method getCounters.
@Override
public TezCounters getCounters() {
readLock.lock();
try {
reportedStatus.setLocalityCounter(this.localityCounter);
TezCounters counters = reportedStatus.counters;
if (counters == null) {
counters = EMPTY_COUNTERS;
}
return counters;
} finally {
readLock.unlock();
}
}
use of org.apache.tez.common.counters.TezCounters in project tez by apache.
the class DAGImpl method getAllCounters.
@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();
}
}
use of org.apache.tez.common.counters.TezCounters in project tez by apache.
the class DAGImpl method finished.
private DAGState finished(DAGState finalState) {
if (finishTime == 0) {
setFinishTime();
}
entityUpdateTracker.stop();
boolean recoveryError = false;
// update cpu time counters before finishing the dag
updateCpuCounters();
TezCounters counters = null;
try {
counters = getAllCounters();
} catch (LimitExceededException e) {
addDiagnostic("Counters limit exceeded: " + e.getMessage());
finalState = DAGState.FAILED;
}
try {
if (finalState == DAGState.SUCCEEDED) {
logJobHistoryFinishedEvent(counters);
} else {
logJobHistoryUnsuccesfulEvent(finalState, counters);
}
} catch (IOException e) {
LOG.warn("Failed to persist recovery event for DAG completion" + ", dagId=" + dagId + ", finalState=" + finalState);
recoveryError = true;
}
if (finalState != DAGState.SUCCEEDED) {
abortOutputs();
}
if (recoveryError) {
eventHandler.handle(new DAGAppMasterEventDAGFinished(getID(), DAGState.ERROR));
} else {
eventHandler.handle(new DAGAppMasterEventDAGFinished(getID(), finalState));
}
LOG.info("DAG: " + getID() + " finished with state: " + finalState);
return finalState;
}
use of org.apache.tez.common.counters.TezCounters in project tez by apache.
the class DAGImpl method getCachedCounters.
@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();
}
}
Aggregations