use of org.apache.tez.dag.app.dag.VertexState 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.tez.dag.app.dag.VertexState in project tez by apache.
the class TestVertexStatusBuilder method testVertexStateConversion.
@Test(timeout = 5000)
public void testVertexStateConversion() {
for (VertexState state : VertexState.values()) {
DAGProtos.VertexStatusStateProto stateProto = VertexStatusBuilder.getProtoState(state);
VertexStatus.State clientState = VertexStatus.getState(stateProto);
Assert.assertEquals(state.name(), clientState.name());
}
}
Aggregations