Пример #1
0
        private void PrintAnalysis(JobHistoryParser.TaskAttemptInfo[] tasks, IComparer <JobHistoryParser.TaskAttemptInfo
                                                                                        > cmp, string taskType, long avg, int showTasks)
        {
            Arrays.Sort(tasks, cmp);
            JobHistoryParser.TaskAttemptInfo min = tasks[tasks.Length - 1];
            StringBuilder details = new StringBuilder();

            details.Append("\nTime taken by best performing ");
            details.Append(taskType).Append(" task ");
            details.Append(min.GetAttemptId().GetTaskID().ToString()).Append(": ");
            if ("map".Equals(taskType))
            {
                details.Append(StringUtils.FormatTimeDiff(min.GetFinishTime(), min.GetStartTime()
                                                          ));
            }
            else
            {
                if ("shuffle".Equals(taskType))
                {
                    details.Append(StringUtils.FormatTimeDiff(min.GetShuffleFinishTime(), min.GetStartTime
                                                                  ()));
                }
                else
                {
                    details.Append(StringUtils.FormatTimeDiff(min.GetFinishTime(), min.GetShuffleFinishTime
                                                                  ()));
                }
            }
            details.Append("\nAverage time taken by ");
            details.Append(taskType).Append(" tasks: ");
            details.Append(StringUtils.FormatTimeDiff(avg, 0));
            details.Append("\nWorse performing ");
            details.Append(taskType).Append(" tasks: ");
            details.Append("\nTaskId\t\tTimetaken");
            System.Console.Out.WriteLine(details.ToString());
            for (int i = 0; i < showTasks && i < tasks.Length; i++)
            {
                details.Length = 0;
                details.Append(tasks[i].GetAttemptId().GetTaskID()).Append(" ");
                if ("map".Equals(taskType))
                {
                    details.Append(StringUtils.FormatTimeDiff(tasks[i].GetFinishTime(), tasks[i].GetStartTime
                                                                  ()));
                }
                else
                {
                    if ("shuffle".Equals(taskType))
                    {
                        details.Append(StringUtils.FormatTimeDiff(tasks[i].GetShuffleFinishTime(), tasks[
                                                                      i].GetStartTime()));
                    }
                    else
                    {
                        details.Append(StringUtils.FormatTimeDiff(tasks[i].GetFinishTime(), tasks[i].GetShuffleFinishTime
                                                                      ()));
                    }
                }
                System.Console.Out.WriteLine(details.ToString());
            }
        }
Пример #2
0
 private void HandleTaskAttemptFinishedEvent(TaskAttemptFinishedEvent @event)
 {
     JobHistoryParser.TaskInfo        taskInfo    = info.tasksMap[@event.GetTaskId()];
     JobHistoryParser.TaskAttemptInfo attemptInfo = taskInfo.attemptsMap[@event.GetAttemptId
                                                                             ()];
     attemptInfo.finishTime = @event.GetFinishTime();
     attemptInfo.status     = StringInterner.WeakIntern(@event.GetTaskStatus());
     attemptInfo.state      = StringInterner.WeakIntern(@event.GetState());
     attemptInfo.counters   = @event.GetCounters();
     attemptInfo.hostname   = StringInterner.WeakIntern(@event.GetHostname());
     info.completedTaskAttemptsMap[@event.GetAttemptId()] = attemptInfo;
 }
Пример #3
0
        /// <summary>Return the TaskLogsUrl of a particular TaskAttempt</summary>
        /// <param name="attempt"/>
        /// <returns>
        /// the taskLogsUrl. null if http-port or tracker-name or
        /// task-attempt-id are unavailable.
        /// </returns>
        public static string GetTaskLogsUrl(string scheme, JobHistoryParser.TaskAttemptInfo
                                            attempt)
        {
            if (attempt.GetHttpPort() == -1 || attempt.GetTrackerName().Equals(string.Empty) ||
                attempt.GetAttemptId() == null)
            {
                return(null);
            }
            string taskTrackerName = HostUtil.ConvertTrackerNameToHostName(attempt.GetTrackerName
                                                                               ());

            return(HostUtil.GetTaskLogUrl(scheme, taskTrackerName, Sharpen.Extensions.ToString
                                              (attempt.GetHttpPort()), attempt.GetAttemptId().ToString()));
        }
Пример #4
0
        private void HandleTaskAttemptStartedEvent(TaskAttemptStartedEvent @event)
        {
            TaskAttemptID attemptId = @event.GetTaskAttemptId();

            JobHistoryParser.TaskInfo        taskInfo    = info.tasksMap[@event.GetTaskId()];
            JobHistoryParser.TaskAttemptInfo attemptInfo = new JobHistoryParser.TaskAttemptInfo
                                                               ();
            attemptInfo.startTime           = @event.GetStartTime();
            attemptInfo.attemptId           = @event.GetTaskAttemptId();
            attemptInfo.httpPort            = @event.GetHttpPort();
            attemptInfo.trackerName         = StringInterner.WeakIntern(@event.GetTrackerName());
            attemptInfo.taskType            = @event.GetTaskType();
            attemptInfo.shufflePort         = @event.GetShufflePort();
            attemptInfo.containerId         = @event.GetContainerId();
            taskInfo.attemptsMap[attemptId] = attemptInfo;
        }
Пример #5
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;
 }
Пример #6
0
        private void PrintLast(JobHistoryParser.TaskAttemptInfo[] tasks, string taskType,
                               IComparer <JobHistoryParser.TaskAttemptInfo> cmp)
        {
            Arrays.Sort(tasks, cFinishMapRed);
            JobHistoryParser.TaskAttemptInfo last = tasks[0];
            StringBuilder lastBuf = new StringBuilder();

            lastBuf.Append("The last ").Append(taskType);
            lastBuf.Append(" task ").Append(last.GetAttemptId().GetTaskID());
            long finishTime;

            if ("shuffle".Equals(taskType))
            {
                finishTime = last.GetShuffleFinishTime();
            }
            else
            {
                finishTime = last.GetFinishTime();
            }
            lastBuf.Append(" finished at (relative to the Job launch time): ");
            lastBuf.Append(StringUtils.GetFormattedTimeWithDiff(dateFormat, finishTime, job.GetLaunchTime
                                                                    ()));
            System.Console.Out.WriteLine(lastBuf.ToString());
        }