示例#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();
    }
  }
示例#2
0
 public QueryState getState() {
   readLock.lock();
   try {
     return stateMachine.getCurrentState();
   } finally {
     readLock.unlock();
   }
 }
示例#3
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();
   }
 }
示例#5
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;
   }
 }