org.apache.hadoop.yarn.state.InvalidStateTransitonException Java Examples

The following examples show how to use org.apache.hadoop.yarn.state.InvalidStateTransitonException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RMNodeImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
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 (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
      LOG.error("Invalid event " + event.getType() + 
          " on Node  " + this.nodeId);
    }
    if (oldState != getState()) {
      LOG.info(nodeId + " Node Transitioned from " + oldState + " to "
               + getState());
    }
  }
  
  finally {
    writeLock.unlock();
  }
}
 
Example #2
Source File: AMNodeImpl.java    From tez with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(AMNodeEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing AMNodeEvent " + event.getNodeId()
        + " of type " + event.getType() + " while in state: " + getState()
        + ". Event: " + event);
  }
  this.writeLock.lock();
  try {
    final AMNodeState oldState = getState();
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle event " + event.getType()
          + " at current state " + oldState + " for NodeId " + this.nodeId, e);
      // TODO Should this fail the job ?
    }
    if (oldState != getState()) {
      LOG.info("AMNode " + this.nodeId + " transitioned from " + oldState
          + " to " + getState());
    }
  } finally {
    writeLock.unlock();
  }
}
 
Example #3
Source File: AMNodeImpl.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(AMNodeEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing AMNodeEvent " + event.getNodeId()
        + " of type " + event.getType() + " while in state: " + getState()
        + ". Event: " + event);
  }
  this.writeLock.lock();
  try {
    final AMNodeState oldState = getState();
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle event " + event.getType()
          + " at current state " + oldState + " for NodeId " + this.nodeId, e);
      // TODO Should this fail the job ?
    }
    if (oldState != getState()) {
      LOG.info("AMNode " + this.nodeId + " transitioned from " + oldState
          + " to " + getState());
    }
  } finally {
    writeLock.unlock();
  }
}
 
Example #4
Source File: TaskImpl.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
@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();
  }
}
 
Example #5
Source File: TaskImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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 (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();
  }
}
 
Example #6
Source File: RMStateStore.java    From big-c with Apache License 2.0 6 votes vote down vote up
protected void handleStoreEvent(RMStateStoreEvent event) {
  this.writeLock.lock();
  try {

    if (LOG.isDebugEnabled()) {
      LOG.debug("Processing event of type " + event.getType());
    }

    final RMStateStoreState oldState = getRMStateStoreState();

    this.stateMachine.doTransition(event.getType(), event);

    if (oldState != getRMStateStoreState()) {
      LOG.info("RMStateStore state change from " + oldState + " to "
          + getRMStateStoreState());
    }

  } catch (InvalidStateTransitonException e) {
    LOG.error("Can't handle this event at current state", e);
  } finally {
    this.writeLock.unlock();
  }
}
 
Example #7
Source File: RMAppAttemptImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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 (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
      /* TODO fail the application on the failed transition */
    }

    if (oldState != getAppAttemptState()) {
      LOG.info(appAttemptID + " State change from " + oldState + " to "
          + getAppAttemptState());
    }
  } finally {
    this.writeLock.unlock();
  }
}
 
Example #8
Source File: RMAppImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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 (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
      /* TODO fail the application on the failed transition */
    }

    if (oldState != getState()) {
      LOG.info(appID + " State change from " + oldState + " to "
          + getState());
    }
  } finally {
    this.writeLock.unlock();
  }
}
 
Example #9
Source File: LocalizedResource.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(ResourceEvent event) {
  try {
    this.writeLock.lock();

    Path resourcePath = event.getLocalResourceRequest().getPath();
    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 (InvalidStateTransitonException e) {
      LOG.warn("Can't handle this event at current state", e);
    }
    if (oldState != newState) {
      LOG.info("Resource " + resourcePath + (localPath != null ? 
        "(->" + localPath + ")": "") + " transitioned from " + oldState
          + " to " + newState);
    }
  } finally {
    this.writeLock.unlock();
  }
}
 
Example #10
Source File: RMContainerImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(RMContainerEvent event) {
  LOG.debug("Processing " + event.getContainerId() + " of type " + event.getType());
  try {
    writeLock.lock();
    RMContainerState oldState = getState();
    try {
       stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
      LOG.error("Invalid event " + event.getType() + 
          " on container " + this.containerId);
    }
    if (oldState != getState()) {
      LOG.info(event.getContainerId() + " Container Transitioned from "
          + oldState + " to " + getState());
    }
  }
  
  finally {
    writeLock.unlock();
  }
}
 
Example #11
Source File: ContainerImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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();
  }
}
 
Example #12
Source File: ApplicationImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(ApplicationEvent event) {

  this.writeLock.lock();

  try {
    ApplicationId applicationID = event.getApplicationID();
    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 (InvalidStateTransitonException e) {
      LOG.warn("Can't handle this event at current state", e);
    }
    if (oldState != newState) {
      LOG.info("Application " + applicationID + " transitioned from "
          + oldState + " to " + newState);
    }
  } finally {
    this.writeLock.unlock();
  }
}
 
Example #13
Source File: TaskImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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 (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();
  }
}
 
Example #14
Source File: ApplicationImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(ApplicationEvent event) {

  this.writeLock.lock();

  try {
    ApplicationId applicationID = event.getApplicationID();
    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 (InvalidStateTransitonException e) {
      LOG.warn("Can't handle this event at current state", e);
    }
    if (oldState != newState) {
      LOG.info("Application " + applicationID + " transitioned from "
          + oldState + " to " + newState);
    }
  } finally {
    this.writeLock.unlock();
  }
}
 
Example #15
Source File: ContainerImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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();
  }
}
 
Example #16
Source File: RMContainerImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(RMContainerEvent event) {
  LOG.debug("Processing " + event.getContainerId() + " of type " + event.getType());
  try {
    writeLock.lock();
    RMContainerState oldState = getState();
    try {
       stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
      LOG.error("Invalid event " + event.getType() + 
          " on container " + this.containerId);
    }
    if (oldState != getState()) {
      LOG.info(event.getContainerId() + " Container Transitioned from "
          + oldState + " to " + getState());
    }
  }
  
  finally {
    writeLock.unlock();
  }
}
 
Example #17
Source File: RMNodeImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
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 (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
      LOG.error("Invalid event " + event.getType() + 
          " on Node  " + this.nodeId);
    }
    if (oldState != getState()) {
      LOG.info(nodeId + " Node Transitioned from " + oldState + " to "
               + getState());
    }
  }
  
  finally {
    writeLock.unlock();
  }
}
 
Example #18
Source File: RMAppImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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 (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
      /* TODO fail the application on the failed transition */
    }

    if (oldState != getState()) {
      LOG.info(appID + " State change from " + oldState + " to "
          + getState());
    }
  } finally {
    this.writeLock.unlock();
  }
}
 
Example #19
Source File: RMAppAttemptImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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 (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
      /* TODO fail the application on the failed transition */
    }

    if (oldState != getAppAttemptState()) {
      LOG.info(appAttemptID + " State change from " + oldState + " to "
          + getAppAttemptState());
    }
  } finally {
    this.writeLock.unlock();
  }
}
 
Example #20
Source File: RMStateStore.java    From hadoop with Apache License 2.0 6 votes vote down vote up
protected void handleStoreEvent(RMStateStoreEvent event) {
  this.writeLock.lock();
  try {

    if (LOG.isDebugEnabled()) {
      LOG.debug("Processing event of type " + event.getType());
    }

    final RMStateStoreState oldState = getRMStateStoreState();

    this.stateMachine.doTransition(event.getType(), event);

    if (oldState != getRMStateStoreState()) {
      LOG.info("RMStateStore state change from " + oldState + " to "
          + getRMStateStoreState());
    }

  } catch (InvalidStateTransitonException e) {
    LOG.error("Can't handle this event at current state", e);
  } finally {
    this.writeLock.unlock();
  }
}
 
Example #21
Source File: LocalizedResource.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(ResourceEvent event) {
  try {
    this.writeLock.lock();

    Path resourcePath = event.getLocalResourceRequest().getPath();
    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 (InvalidStateTransitonException e) {
      LOG.warn("Can't handle this event at current state", e);
    }
    if (oldState != newState) {
      LOG.info("Resource " + resourcePath + (localPath != null ? 
        "(->" + localPath + ")": "") + " transitioned from " + oldState
          + " to " + newState);
    }
  } finally {
    this.writeLock.unlock();
  }
}
 
Example #22
Source File: NMClientAsyncImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public void handle(ContainerEvent event) {
  writeLock.lock();
  try {
    try {
      this.stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
    }
  } finally {
    writeLock.unlock();
  }
}
 
Example #23
Source File: TaskAttemptImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@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 (InvalidStateTransitonException 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()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
 
Example #24
Source File: JobImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
/**
 * The only entry point to change the Job.
 */
public 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 (InvalidStateTransitonException 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();
  }
}
 
Example #25
Source File: NMClientAsyncImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void handle(ContainerEvent event) {
  writeLock.lock();
  try {
    try {
      this.stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
    }
  } finally {
    writeLock.unlock();
  }
}
 
Example #26
Source File: DAGImpl.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
@Override
/**
 * The only entry point to change the DAG.
 */
public void handle(DAGEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing DAGEvent " + event.getDAGId() + " of type "
        + event.getType() + " while in state " + getInternalState()
        + ". Event: " + event);
  }
  try {
    writeLock.lock();
    DAGState oldState = getInternalState();
    try {
       getStateMachine().doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state", e);
      addDiagnostic("Invalid event " + event.getType() +
          " on Job " + this.dagId);
      eventHandler.handle(new DAGEvent(this.dagId,
          DAGEventType.INTERNAL_ERROR));
    }
    //notify the eventhandler of state change
    if (oldState != getInternalState()) {
      LOG.info(dagId + " transitioned from " + oldState + " to "
               + getInternalState());
    }
  }

  finally {
    writeLock.unlock();
  }
}
 
Example #27
Source File: TaskAttemptImpl.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing TaskAttemptEvent " + event.getTaskAttemptID()
        + " of type " + event.getType() + " while in state "
        + getInternalState() + ". Event: " + event);
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState();
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new DAGEventDiagnosticsUpdate(
          this.attemptId.getTaskID().getVertexID().getDAGId(),
          "Invalid event " + event.getType() +
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(
          new DAGEvent(
              this.attemptId.getTaskID().getVertexID().getDAGId(),
              DAGEventType.INTERNAL_ERROR)
          );
    }
    if (oldState != getInternalState()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from "
         + oldState + " to "
         + getInternalState() + " due to event "
         + event.getType());
    }
  } finally {
    writeLock.unlock();
  }
}
 
Example #28
Source File: VertexImpl.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
@Override
/**
 * The only entry point to change the Vertex.
 */
public 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));
    }

    if (oldState != getInternalState()) {
      LOG.info(logIdentifier + " transitioned from " + oldState + " to "
          + getInternalState() + " due to event "
          + event.getType());
    }
  }

  finally {
    writeLock.unlock();
  }
}
 
Example #29
Source File: TaskAttemptImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@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 (InvalidStateTransitonException 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()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
 
Example #30
Source File: AMContainerImpl.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
@Override
public void handle(AMContainerEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing AMContainerEvent " + event.getContainerId()
        + " of type " + event.getType() + " while in state: " + getState()
        + ". Event: " + event);
  }
  this.writeLock.lock();
  try {
    final AMContainerState oldState = getState();
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle event " + event.getType()
          + " at current state " + oldState + " for ContainerId "
          + this.containerId, e);
      inError = true;
      // TODO Can't set state to COMPLETED. Add a default error state.
    }
    if (oldState != getState()) {
      LOG.info("AMContainer " + this.containerId + " transitioned from "
          + oldState + " to " + getState()
          + " via event " + event.getType());
    }
  } finally {
    writeLock.unlock();
  }
}