use of org.apache.hadoop.yarn.state.InvalidStateTransitionException in project hadoop by apache.
the class RMAppAttemptImpl method handle.
@Override
public void handle(RMAppAttemptEvent event) {
this.writeLock.lock();
try {
ApplicationAttemptId appAttemptID = event.getApplicationAttemptId();
LOG.debug("Processing event for " + appAttemptID + " of type " + event.getType());
final RMAppAttemptState oldState = getAppAttemptState();
try {
/* keep the master in sync with the state machine */
this.stateMachine.doTransition(event.getType(), event);
} catch (InvalidStateTransitionException e) {
LOG.error("Can't handle this event at current state", e);
/* TODO fail the application on the failed transition */
}
// Log at DEBUG otherwise.
if ((oldState != getAppAttemptState()) && ((recoveredFinalState == null) || (event.getType() != RMAppAttemptEventType.RECOVER))) {
LOG.info(String.format(STATE_CHANGE_MESSAGE, appAttemptID, oldState, getAppAttemptState(), event.getType()));
} else if ((oldState != getAppAttemptState()) && LOG.isDebugEnabled()) {
LOG.debug(String.format(STATE_CHANGE_MESSAGE, appAttemptID, oldState, getAppAttemptState(), event.getType()));
}
} finally {
this.writeLock.unlock();
}
}
use of org.apache.hadoop.yarn.state.InvalidStateTransitionException in project hadoop by apache.
the class RMAppImpl method handle.
@Override
public void handle(RMAppEvent event) {
this.writeLock.lock();
try {
ApplicationId appID = event.getApplicationId();
LOG.debug("Processing event for " + appID + " of type " + event.getType());
final RMAppState oldState = getState();
try {
/* keep the master in sync with the state machine */
this.stateMachine.doTransition(event.getType(), event);
} catch (InvalidStateTransitionException e) {
LOG.error("Can't handle this event at current state", e);
/* TODO fail the application on the failed transition */
}
// Log at DEBUG otherwise.
if ((oldState != getState()) && (((recoveredFinalState == null)) || (event.getType() != RMAppEventType.RECOVER))) {
LOG.info(String.format(STATE_CHANGE_MESSAGE, appID, oldState, getState(), event.getType()));
} else if ((oldState != getState()) && LOG.isDebugEnabled()) {
LOG.debug(String.format(STATE_CHANGE_MESSAGE, appID, oldState, getState(), event.getType()));
}
} finally {
this.writeLock.unlock();
}
}
use of org.apache.hadoop.yarn.state.InvalidStateTransitionException in project hadoop by apache.
the class RMNodeImpl method handle.
public void handle(RMNodeEvent event) {
LOG.debug("Processing " + event.getNodeId() + " of type " + event.getType());
try {
writeLock.lock();
NodeState oldState = getState();
try {
stateMachine.doTransition(event.getType(), event);
} catch (InvalidStateTransitionException e) {
LOG.error("Can't handle this event at current state", e);
LOG.error("Invalid event " + event.getType() + " on Node " + this.nodeId + " oldState " + oldState);
}
if (oldState != getState()) {
LOG.info(nodeId + " Node Transitioned from " + oldState + " to " + getState());
}
} finally {
writeLock.unlock();
}
}
use of org.apache.hadoop.yarn.state.InvalidStateTransitionException in project hadoop by apache.
the class TaskAttemptImpl method handle.
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("Processing " + event.getTaskAttemptID() + " of type " + event.getType());
}
writeLock.lock();
try {
final TaskAttemptStateInternal oldState = getInternalState();
try {
stateMachine.doTransition(event.getType(), event);
} catch (InvalidStateTransitionException e) {
LOG.error("Can't handle this event at current state for " + this.attemptId, e);
eventHandler.handle(new JobDiagnosticsUpdateEvent(this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + " on TaskAttempt " + this.attemptId));
eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(), JobEventType.INTERNAL_ERROR));
}
if (oldState != getInternalState()) {
if (getInternalState() == TaskAttemptStateInternal.FAILED) {
String nodeId = null == this.container ? "Not-assigned" : this.container.getNodeId().toString();
LOG.info(attemptId + " transitioned from state " + oldState + " to " + getInternalState() + ", event type is " + event.getType() + " and nodeId=" + nodeId);
} else {
LOG.info(attemptId + " TaskAttempt Transitioned from " + oldState + " to " + getInternalState());
}
}
} finally {
writeLock.unlock();
}
}
use of org.apache.hadoop.yarn.state.InvalidStateTransitionException in project hadoop by apache.
the class ContainerImpl method handle.
@Override
public void handle(ContainerEvent event) {
try {
this.writeLock.lock();
ContainerId containerID = event.getContainerID();
if (LOG.isDebugEnabled()) {
LOG.debug("Processing " + containerID + " of type " + event.getType());
}
ContainerState oldState = stateMachine.getCurrentState();
ContainerState newState = null;
try {
newState = stateMachine.doTransition(event.getType(), event);
} catch (InvalidStateTransitionException e) {
LOG.warn("Can't handle this event at current state: Current: [" + oldState + "], eventType: [" + event.getType() + "]," + " container: [" + containerID + "]", e);
}
if (newState != null && oldState != newState) {
LOG.info("Container " + containerID + " transitioned from " + oldState + " to " + newState);
}
} finally {
this.writeLock.unlock();
}
}
Aggregations