Search in sources :

Example 1 with InvalidStateTransitonException

use of org.apache.hadoop.yarn.state.InvalidStateTransitonException in project tez by apache.

the class TaskImpl method handle.

@Override
public void handle(TaskEvent event) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Processing TaskEvent " + event.getTaskID() + " of type " + event.getType() + " while in state " + getInternalState() + ". Event: " + event);
    }
    try {
        writeLock.lock();
        TaskStateInternal oldState = getInternalState();
        try {
            stateMachine.doTransition(event.getType(), event);
        } catch (InvalidStateTransitonException e) {
            LOG.error("Can't handle this event" + event.getType() + " at current state " + oldState + " for task " + this.taskId, e);
            internalError(event.getType());
        } catch (RuntimeException e) {
            LOG.error("Uncaught exception when trying handle event " + event.getType() + " at current state " + oldState + " for task " + this.taskId, e);
            internalErrorUncaughtException(event.getType(), e);
        }
        if (oldState != getInternalState()) {
            if (LOG.isDebugEnabled()) {
                LOG.debug(taskId + " Task Transitioned from " + oldState + " to " + getInternalState() + " due to event " + event.getType());
            }
        }
    } finally {
        writeLock.unlock();
    }
}
Also used : TaskStateInternal(org.apache.tez.dag.app.dag.TaskStateInternal) InvalidStateTransitonException(org.apache.hadoop.yarn.state.InvalidStateTransitonException)

Example 2 with InvalidStateTransitonException

use of org.apache.hadoop.yarn.state.InvalidStateTransitonException in project tez by apache.

the class VertexImpl method handle.

@Override
public /**
 * The only entry point to change the Vertex.
 */
void handle(VertexEvent event) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Processing VertexEvent " + event.getVertexId() + " of type " + event.getType() + " while in state " + getInternalState() + ". Event: " + event);
    }
    try {
        writeLock.lock();
        VertexState oldState = getInternalState();
        try {
            getStateMachine().doTransition(event.getType(), event);
        } catch (InvalidStateTransitonException e) {
            String message = "Invalid event " + event.getType() + " on vertex " + this.vertexName + " with vertexId " + this.vertexId + " at current state " + oldState;
            LOG.error("Can't handle " + message, e);
            addDiagnostic(message);
            eventHandler.handle(new VertexEvent(this.vertexId, VertexEventType.V_INTERNAL_ERROR));
        } catch (RuntimeException e) {
            String message = "Uncaught Exception when handling event " + event.getType() + " on vertex " + this.vertexName + " with vertexId " + this.vertexId + " at current state " + oldState;
            LOG.error(message, e);
            addDiagnostic(message);
            if (!internalErrorTriggered.getAndSet(true)) {
                eventHandler.handle(new VertexEvent(this.vertexId, VertexEventType.V_INTERNAL_ERROR));
            }
        }
        if (oldState != getInternalState()) {
            LOG.info(logIdentifier + " transitioned from " + oldState + " to " + getInternalState() + " due to event " + event.getType());
        }
    } finally {
        writeLock.unlock();
    }
}
Also used : InvalidStateTransitonException(org.apache.hadoop.yarn.state.InvalidStateTransitonException) VertexEvent(org.apache.tez.dag.app.dag.event.VertexEvent) VertexState(org.apache.tez.dag.app.dag.VertexState)

Example 3 with InvalidStateTransitonException

use of org.apache.hadoop.yarn.state.InvalidStateTransitonException in project tez by apache.

the class DAGImpl method handle.

@Override
public /**
 * The only entry point to change the DAG.
 */
void handle(DAGEvent event) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Processing DAGEvent " + event.getDAGId() + " of type " + event.getType() + " while in state " + getInternalState() + ". Event: " + event);
    }
    try {
        writeLock.lock();
        DAGState oldState = getInternalState();
        try {
            getStateMachine().doTransition(event.getType(), event);
        } catch (InvalidStateTransitonException e) {
            String message = "Invalid event " + event.getType() + " on Dag " + this.dagId + " at currentState=" + oldState;
            LOG.error("Can't handle " + message, e);
            addDiagnostic(message);
            eventHandler.handle(new DAGEvent(this.dagId, DAGEventType.INTERNAL_ERROR));
        } catch (RuntimeException e) {
            String message = "Uncaught Exception when handling event " + event.getType() + " on Dag " + this.dagId + " at currentState=" + oldState;
            LOG.error(message, e);
            addDiagnostic(message);
            if (!internalErrorTriggered.getAndSet(true)) {
                // to prevent a recursive loop
                eventHandler.handle(new DAGEvent(this.dagId, DAGEventType.INTERNAL_ERROR));
            }
        }
        // notify the eventhandler of state change
        if (oldState != getInternalState()) {
            LOG.info(dagId + " transitioned from " + oldState + " to " + getInternalState() + " due to event " + event.getType());
        }
    } finally {
        writeLock.unlock();
    }
}
Also used : DAGEvent(org.apache.tez.dag.app.dag.event.DAGEvent) DAGState(org.apache.tez.dag.app.dag.DAGState) InvalidStateTransitonException(org.apache.hadoop.yarn.state.InvalidStateTransitonException)

Aggregations

InvalidStateTransitonException (org.apache.hadoop.yarn.state.InvalidStateTransitonException)3 DAGState (org.apache.tez.dag.app.dag.DAGState)1 TaskStateInternal (org.apache.tez.dag.app.dag.TaskStateInternal)1 VertexState (org.apache.tez.dag.app.dag.VertexState)1 DAGEvent (org.apache.tez.dag.app.dag.event.DAGEvent)1 VertexEvent (org.apache.tez.dag.app.dag.event.VertexEvent)1