Beispiel #1
0
  @Override
  public void handle(ContainerEvent event) {
    try {
      this.writeLock.lock();

      ContainerId containerID = event.getContainerID();
      LOG.debug("Processing " + containerID + " of type " + event.getType());

      ContainerState oldState = stateMachine.getCurrentState();
      ContainerState newState = null;
      try {
        newState = stateMachine.doTransition(event.getType(), event);
      } catch (InvalidStateTransitonException e) {
        LOG.warn(
            "Can't handle this event at current state: Current: ["
                + oldState
                + "], eventType: ["
                + event.getType()
                + "]",
            e);
      }
      if (oldState != newState) {
        LOG.info("Container " + containerID + " transitioned from " + oldState + " to " + newState);
      }
    } finally {
      this.writeLock.unlock();
    }
  }
 @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 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();
   }
 }
Beispiel #3
0
 public QueryState getState() {
   readLock.lock();
   try {
     return stateMachine.getCurrentState();
   } finally {
     readLock.unlock();
   }
 }
Beispiel #4
0
 @Override
 public ContainerState getContainerState() {
   this.readLock.lock();
   try {
     return stateMachine.getCurrentState();
   } finally {
     this.readLock.unlock();
   }
 }
 @VisibleForTesting
 public TaskStateInternal getInternalState() {
   readLock.lock();
   try {
     return stateMachine.getCurrentState();
   } finally {
     readLock.unlock();
   }
 }
Beispiel #6
0
 public org.apache.hadoop.yarn.api.records.ContainerState getCurrentState() {
   switch (stateMachine.getCurrentState()) {
     case NEW:
     case LOCALIZING:
     case LOCALIZATION_FAILED:
     case LOCALIZED:
     case RUNNING:
     case EXITED_WITH_SUCCESS:
     case EXITED_WITH_FAILURE:
     case KILLING:
     case CONTAINER_CLEANEDUP_AFTER_KILL:
     case CONTAINER_RESOURCES_CLEANINGUP:
       return org.apache.hadoop.yarn.api.records.ContainerState.RUNNING;
     case DONE:
     default:
       return org.apache.hadoop.yarn.api.records.ContainerState.COMPLETE;
   }
 }