예제 #1
0
 private void HandleTaskAttemptFailedEvent(TaskAttemptUnsuccessfulCompletionEvent
                                           @event)
 {
     JobHistoryParser.TaskInfo taskInfo = info.tasksMap[@event.GetTaskId()];
     if (taskInfo == null)
     {
         Log.Warn("TaskInfo is null for TaskAttemptUnsuccessfulCompletionEvent" + " taskId:  "
                  + @event.GetTaskId().ToString());
         return;
     }
     JobHistoryParser.TaskAttemptInfo attemptInfo = taskInfo.attemptsMap[@event.GetTaskAttemptId
                                                                             ()];
     if (attemptInfo == null)
     {
         Log.Warn("AttemptInfo is null for TaskAttemptUnsuccessfulCompletionEvent" + " taskAttemptId:  "
                  + @event.GetTaskAttemptId().ToString());
         return;
     }
     attemptInfo.finishTime        = @event.GetFinishTime();
     attemptInfo.error             = StringInterner.WeakIntern(@event.GetError());
     attemptInfo.status            = StringInterner.WeakIntern(@event.GetTaskStatus());
     attemptInfo.hostname          = StringInterner.WeakIntern(@event.GetHostname());
     attemptInfo.port              = @event.GetPort();
     attemptInfo.rackname          = StringInterner.WeakIntern(@event.GetRackName());
     attemptInfo.shuffleFinishTime = @event.GetFinishTime();
     attemptInfo.sortFinishTime    = @event.GetFinishTime();
     attemptInfo.mapFinishTime     = @event.GetFinishTime();
     attemptInfo.counters          = @event.GetCounters();
     if (TaskStatus.State.Succeeded.ToString().Equals(taskInfo.status))
     {
         //this is a successful task
         if (attemptInfo.GetAttemptId().Equals(taskInfo.GetSuccessfulAttemptId()))
         {
             // the failed attempt is the one that made this task successful
             // so its no longer successful. Reset fields set in
             // handleTaskFinishedEvent()
             taskInfo.counters            = null;
             taskInfo.finishTime          = -1;
             taskInfo.status              = null;
             taskInfo.successfulAttemptId = null;
         }
     }
     info.completedTaskAttemptsMap[@event.GetTaskAttemptId()] = attemptInfo;
 }
예제 #2
0
        /// <summary>Get the next event from the stream</summary>
        /// <returns>the next event</returns>
        /// <exception cref="System.IO.IOException"/>
        public virtual HistoryEvent GetNextEvent()
        {
            Event wrapper;

            try
            {
                wrapper = (Event)reader.Read(null, decoder);
            }
            catch (EOFException)
            {
                // at EOF
                return(null);
            }
            HistoryEvent result;

            switch (wrapper.type)
            {
            case EventType.JobSubmitted:
            {
                result = new JobSubmittedEvent();
                break;
            }

            case EventType.JobInited:
            {
                result = new JobInitedEvent();
                break;
            }

            case EventType.JobFinished:
            {
                result = new JobFinishedEvent();
                break;
            }

            case EventType.JobPriorityChanged:
            {
                result = new JobPriorityChangeEvent();
                break;
            }

            case EventType.JobQueueChanged:
            {
                result = new JobQueueChangeEvent();
                break;
            }

            case EventType.JobStatusChanged:
            {
                result = new JobStatusChangedEvent();
                break;
            }

            case EventType.JobFailed:
            {
                result = new JobUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.JobKilled:
            {
                result = new JobUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.JobError:
            {
                result = new JobUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.JobInfoChanged:
            {
                result = new JobInfoChangeEvent();
                break;
            }

            case EventType.TaskStarted:
            {
                result = new TaskStartedEvent();
                break;
            }

            case EventType.TaskFinished:
            {
                result = new TaskFinishedEvent();
                break;
            }

            case EventType.TaskFailed:
            {
                result = new TaskFailedEvent();
                break;
            }

            case EventType.TaskUpdated:
            {
                result = new TaskUpdatedEvent();
                break;
            }

            case EventType.MapAttemptStarted:
            {
                result = new TaskAttemptStartedEvent();
                break;
            }

            case EventType.MapAttemptFinished:
            {
                result = new MapAttemptFinishedEvent();
                break;
            }

            case EventType.MapAttemptFailed:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.MapAttemptKilled:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.ReduceAttemptStarted:
            {
                result = new TaskAttemptStartedEvent();
                break;
            }

            case EventType.ReduceAttemptFinished:
            {
                result = new ReduceAttemptFinishedEvent();
                break;
            }

            case EventType.ReduceAttemptFailed:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.ReduceAttemptKilled:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.SetupAttemptStarted:
            {
                result = new TaskAttemptStartedEvent();
                break;
            }

            case EventType.SetupAttemptFinished:
            {
                result = new TaskAttemptFinishedEvent();
                break;
            }

            case EventType.SetupAttemptFailed:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.SetupAttemptKilled:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.CleanupAttemptStarted:
            {
                result = new TaskAttemptStartedEvent();
                break;
            }

            case EventType.CleanupAttemptFinished:
            {
                result = new TaskAttemptFinishedEvent();
                break;
            }

            case EventType.CleanupAttemptFailed:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.CleanupAttemptKilled:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.AmStarted:
            {
                result = new AMStartedEvent();
                break;
            }

            default:
            {
                throw new RuntimeException("unexpected event type: " + wrapper.type);
            }
            }
            result.SetDatum(wrapper.@event);
            return(result);
        }