use of org.apache.hadoop.yarn.state.InvalidStateTransitionException in project hadoop by apache.
the class TaskImpl method handle.
@Override
public void handle(TaskEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("Processing " + event.getTaskID() + " of type " + event.getType());
}
try {
writeLock.lock();
TaskStateInternal oldState = getInternalState();
try {
stateMachine.doTransition(event.getType(), event);
} catch (InvalidStateTransitionException e) {
LOG.error("Can't handle this event at current state for " + this.taskId, e);
internalError(event.getType());
}
if (oldState != getInternalState()) {
LOG.info(taskId + " Task Transitioned from " + oldState + " to " + getInternalState());
}
} finally {
writeLock.unlock();
}
}
use of org.apache.hadoop.yarn.state.InvalidStateTransitionException in project hadoop by apache.
the class JobImpl method handle.
@Override
public /**
* The only entry point to change the Job.
*/
void handle(JobEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("Processing " + event.getJobId() + " of type " + event.getType());
}
try {
writeLock.lock();
JobStateInternal oldState = getInternalState();
try {
getStateMachine().doTransition(event.getType(), event);
} catch (InvalidStateTransitionException e) {
LOG.error("Can't handle this event at current state", e);
addDiagnostic("Invalid event " + event.getType() + " on Job " + this.jobId);
eventHandler.handle(new JobEvent(this.jobId, JobEventType.INTERNAL_ERROR));
}
//notify the eventhandler of state change
if (oldState != getInternalState()) {
LOG.info(jobId + "Job Transitioned from " + oldState + " to " + getInternalState());
rememberLastNonFinalState(oldState);
}
} finally {
writeLock.unlock();
}
}
use of org.apache.hadoop.yarn.state.InvalidStateTransitionException in project hadoop by apache.
the class LocalizedResource method handle.
@Override
public void handle(ResourceEvent event) {
try {
this.writeLock.lock();
Path resourcePath = event.getLocalResourceRequest().getPath();
if (LOG.isDebugEnabled()) {
LOG.debug("Processing " + resourcePath + " of type " + event.getType());
}
ResourceState oldState = this.stateMachine.getCurrentState();
ResourceState newState = null;
try {
newState = this.stateMachine.doTransition(event.getType(), event);
} catch (InvalidStateTransitionException e) {
LOG.warn("Can't handle this event at current state", e);
}
if (newState != null && oldState != newState) {
if (LOG.isDebugEnabled()) {
LOG.debug("Resource " + resourcePath + (localPath != null ? "(->" + localPath + ")" : "") + " transitioned from " + oldState + " to " + newState);
}
}
} finally {
this.writeLock.unlock();
}
}
use of org.apache.hadoop.yarn.state.InvalidStateTransitionException in project hadoop by apache.
the class ApplicationImpl method handle.
@Override
public void handle(ApplicationEvent event) {
this.writeLock.lock();
try {
ApplicationId applicationID = event.getApplicationID();
if (LOG.isDebugEnabled()) {
LOG.debug("Processing " + applicationID + " of type " + event.getType());
}
ApplicationState oldState = stateMachine.getCurrentState();
ApplicationState newState = null;
try {
// queue event requesting init of the same app
newState = stateMachine.doTransition(event.getType(), event);
} catch (InvalidStateTransitionException e) {
LOG.warn("Can't handle this event at current state", e);
}
if (newState != null && oldState != newState) {
LOG.info("Application " + applicationID + " transitioned from " + oldState + " to " + newState);
}
} finally {
this.writeLock.unlock();
}
}
use of org.apache.hadoop.yarn.state.InvalidStateTransitionException in project hadoop by apache.
the class SchedulerApplicationAttempt method commonReserve.
private boolean commonReserve(SchedulerNode node, SchedulerRequestKey schedulerKey, RMContainer rmContainer, Resource reservedResource) {
try {
rmContainer.handle(new RMContainerReservedEvent(rmContainer.getContainerId(), reservedResource, node.getNodeID(), schedulerKey));
} catch (InvalidStateTransitionException e) {
// false indicate it fails
return false;
}
Map<NodeId, RMContainer> reservedContainers = this.reservedContainers.get(schedulerKey);
if (reservedContainers == null) {
reservedContainers = new HashMap<NodeId, RMContainer>();
this.reservedContainers.put(schedulerKey, reservedContainers);
}
reservedContainers.put(node.getNodeID(), rmContainer);
if (LOG.isDebugEnabled()) {
LOG.debug("Application attempt " + getApplicationAttemptId() + " reserved container " + rmContainer + " on node " + node + ". This attempt currently has " + reservedContainers.size() + " reserved containers at priority " + schedulerKey.getPriority() + "; currentReservation " + reservedResource);
}
return true;
}
Aggregations