Search in sources :

Example 6 with LimitExceededException

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) {
    }
}
Also used : LimitExceededException(org.apache.tez.common.counters.LimitExceededException) TezCounters(org.apache.tez.common.counters.TezCounters) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) Test(org.junit.Test)

Example 7 with LimitExceededException

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);
    }
}
Also used : LimitExceededException(org.apache.tez.common.counters.LimitExceededException) TezCounters(org.apache.tez.common.counters.TezCounters)

Example 8 with LimitExceededException

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;
}
Also used : DAGEvent(org.apache.tez.dag.app.dag.event.DAGEvent) TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) DAGEventVertexCompleted(org.apache.tez.dag.app.dag.event.DAGEventVertexCompleted) LimitExceededException(org.apache.tez.common.counters.LimitExceededException) IOException(java.io.IOException)

Aggregations

LimitExceededException (org.apache.tez.common.counters.LimitExceededException)8 TezCounters (org.apache.tez.common.counters.TezCounters)7 ImmutableMap (com.google.common.collect.ImmutableMap)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 TreeMap (java.util.TreeMap)4 Set (java.util.Set)3 DAG (org.apache.tez.dag.app.dag.DAG)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)1 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)1 ProgressBuilder (org.apache.tez.dag.api.client.ProgressBuilder)1 Task (org.apache.tez.dag.app.dag.Task)1 TaskAttempt (org.apache.tez.dag.app.dag.TaskAttempt)1 DAGAppMasterEventDAGFinished (org.apache.tez.dag.app.dag.event.DAGAppMasterEventDAGFinished)1 DAGEvent (org.apache.tez.dag.app.dag.event.DAGEvent)1 DAGEventVertexCompleted (org.apache.tez.dag.app.dag.event.DAGEventVertexCompleted)1 Test (org.junit.Test)1