Search in sources :

Example 6 with JobDiagnosticsUpdateEvent

use of org.apache.hadoop.mapreduce.v2.app.job.event.JobDiagnosticsUpdateEvent 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();
    }
}
Also used : TaskAttemptStateInternal(org.apache.hadoop.mapreduce.v2.app.job.TaskAttemptStateInternal) InvalidStateTransitionException(org.apache.hadoop.yarn.state.InvalidStateTransitionException) JobEvent(org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent) JobDiagnosticsUpdateEvent(org.apache.hadoop.mapreduce.v2.app.job.event.JobDiagnosticsUpdateEvent)

Aggregations

JobDiagnosticsUpdateEvent (org.apache.hadoop.mapreduce.v2.app.job.event.JobDiagnosticsUpdateEvent)6 JobEvent (org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent)6 JobId (org.apache.hadoop.mapreduce.v2.api.records.JobId)4 Resource (org.apache.hadoop.yarn.api.records.Resource)3 JobHistoryEvent (org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent)2 NormalizedResourceEvent (org.apache.hadoop.mapreduce.jobhistory.NormalizedResourceEvent)2 IOException (java.io.IOException)1 Configuration (org.apache.hadoop.conf.Configuration)1 JobID (org.apache.hadoop.mapreduce.JobID)1 JobTokenSecretManager (org.apache.hadoop.mapreduce.security.token.JobTokenSecretManager)1 AppContext (org.apache.hadoop.mapreduce.v2.app.AppContext)1 MRAppMaster (org.apache.hadoop.mapreduce.v2.app.MRAppMaster)1 CommitterEventHandler (org.apache.hadoop.mapreduce.v2.app.commit.CommitterEventHandler)1 TaskAttemptStateInternal (org.apache.hadoop.mapreduce.v2.app.job.TaskAttemptStateInternal)1 MRAppMetrics (org.apache.hadoop.mapreduce.v2.app.metrics.MRAppMetrics)1 AllocateResponse (org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse)1 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)1 Container (org.apache.hadoop.yarn.api.records.Container)1 ContainerStatus (org.apache.hadoop.yarn.api.records.ContainerStatus)1 NMToken (org.apache.hadoop.yarn.api.records.NMToken)1