use of org.apache.tez.common.counters.LimitExceededException in project tez by apache.
the class TestTezClient method testTezClientCounterLimits.
@Test(timeout = 5000)
public void testTezClientCounterLimits() throws YarnException, IOException, ServiceException {
Limits.reset();
int defaultCounterLimit = TezConfiguration.TEZ_COUNTERS_MAX_DEFAULT;
int newCounterLimit = defaultCounterLimit + 500;
TezConfiguration conf = new TezConfiguration();
conf.setInt(TezConfiguration.TEZ_COUNTERS_MAX, newCounterLimit);
configureAndCreateTezClient(conf);
TezCounters counters = new TezCounters();
for (int i = 0; i < newCounterLimit; i++) {
counters.findCounter("GroupName", "TestCounter" + i).setValue(i);
}
try {
counters.findCounter("GroupName", "TestCounterFail").setValue(1);
fail("Expecting a LimitExceedException - too many counters");
} catch (LimitExceededException e) {
}
}
use of org.apache.tez.common.counters.LimitExceededException in project tez by apache.
the class VertexImpl method logJobHistoryVertexFailedEvent.
void logJobHistoryVertexFailedEvent(VertexState state) throws IOException {
if (recoveryData == null || !recoveryData.isVertexFinished()) {
TezCounters counters = null;
try {
counters = getAllCounters();
} catch (LimitExceededException e) {
// Ignore as failed vertex
addDiagnostic("Counters limit exceeded: " + e.getMessage());
}
logJobHistoryVertexCompletedHelper(state, clock.getTime(), StringUtils.join(getDiagnostics(), LINE_SEPARATOR), counters);
}
}
use of org.apache.tez.common.counters.LimitExceededException in project tez by apache.
the class VertexImpl method finished.
VertexState finished(VertexState finalState, VertexTerminationCause termCause, String diag) {
if (finishTime == 0)
setFinishTime();
if (termCause != null) {
trySetTerminationCause(termCause);
}
if (rootInputInitializerManager != null) {
rootInputInitializerManager.shutdown();
rootInputInitializerManager = null;
}
switch(finalState) {
case ERROR:
addDiagnostic("Vertex: " + logIdentifier + " error due to:" + terminationCause);
if (!StringUtils.isEmpty(diag)) {
addDiagnostic(diag);
}
abortVertex(VertexStatus.State.valueOf(finalState.name()));
eventHandler.handle(new DAGEvent(getDAGId(), DAGEventType.INTERNAL_ERROR));
try {
logJobHistoryVertexFailedEvent(finalState);
} catch (IOException e) {
LOG.error("Failed to send vertex finished event to recovery", e);
}
break;
case KILLED:
case FAILED:
addDiagnostic("Vertex " + logIdentifier + " killed/failed due to:" + terminationCause);
if (!StringUtils.isEmpty(diag)) {
addDiagnostic(diag);
}
abortVertex(VertexStatus.State.valueOf(finalState.name()));
eventHandler.handle(new DAGEventVertexCompleted(getVertexId(), finalState, terminationCause));
try {
logJobHistoryVertexFailedEvent(finalState);
} catch (IOException e) {
LOG.error("Failed to send vertex finished event to recovery", e);
}
break;
case SUCCEEDED:
try {
try {
logJobHistoryVertexFinishedEvent();
eventHandler.handle(new DAGEventVertexCompleted(getVertexId(), finalState));
} catch (LimitExceededException e) {
LOG.error("Counter limits exceeded for vertex: " + getLogIdentifier(), e);
finalState = VertexState.FAILED;
addDiagnostic("Counters limit exceeded: " + e.getMessage());
trySetTerminationCause(VertexTerminationCause.COUNTER_LIMITS_EXCEEDED);
logJobHistoryVertexFailedEvent(finalState);
eventHandler.handle(new DAGEventVertexCompleted(getVertexId(), finalState));
}
} catch (IOException e) {
LOG.error("Failed to send vertex finished event to recovery", e);
finalState = VertexState.FAILED;
trySetTerminationCause(VertexTerminationCause.INTERNAL_ERROR);
eventHandler.handle(new DAGEventVertexCompleted(getVertexId(), finalState));
}
break;
default:
throw new TezUncheckedException("Unexpected VertexState: " + finalState);
}
return finalState;
}
Aggregations