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();
}
}
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();
}
}
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();
}
}
Aggregations