示例#1
0
 private void ConstructTaskAttemptReport()
 {
     report = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <TaskAttemptReport>();
     report.SetTaskAttemptId(attemptId);
     report.SetTaskAttemptState(state);
     report.SetProgress(GetProgress());
     report.SetStartTime(attemptInfo.GetStartTime());
     report.SetFinishTime(attemptInfo.GetFinishTime());
     report.SetShuffleFinishTime(attemptInfo.GetShuffleFinishTime());
     report.SetSortFinishTime(attemptInfo.GetSortFinishTime());
     if (localDiagMessage != null)
     {
         report.SetDiagnosticInfo(attemptInfo.GetError() + ", " + localDiagMessage);
     }
     else
     {
         report.SetDiagnosticInfo(attemptInfo.GetError());
     }
     // report.setPhase(attemptInfo.get); //TODO
     report.SetStateString(attemptInfo.GetState());
     report.SetCounters(TypeConverter.ToYarn(GetCounters()));
     report.SetContainerId(attemptInfo.GetContainerId());
     if (attemptInfo.GetHostname() == null)
     {
         report.SetNodeManagerHost("UNKNOWN");
     }
     else
     {
         report.SetNodeManagerHost(attemptInfo.GetHostname());
         report.SetNodeManagerPort(attemptInfo.GetPort());
     }
     report.SetNodeManagerHttpPort(attemptInfo.GetHttpPort());
 }
示例#2
0
        public static TaskAttemptReport NewTaskAttemptReport(TaskAttemptId id)
        {
            ApplicationAttemptId appAttemptId = ApplicationAttemptId.NewInstance(id.GetTaskId
                                                                                     ().GetJobId().GetAppId(), 0);
            ContainerId       containerId = ContainerId.NewContainerId(appAttemptId, 0);
            TaskAttemptReport report      = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <TaskAttemptReport
                                                                                           >();

            report.SetTaskAttemptId(id);
            report.SetStartTime(Runtime.CurrentTimeMillis() - (int)(Math.Random() * Dt));
            report.SetFinishTime(Runtime.CurrentTimeMillis() + (int)(Math.Random() * Dt) + 1);
            if (id.GetTaskId().GetTaskType() == TaskType.Reduce)
            {
                report.SetShuffleFinishTime((report.GetFinishTime() + report.GetStartTime()) / 2);
                report.SetSortFinishTime((report.GetFinishTime() + report.GetShuffleFinishTime())
                                         / 2);
            }
            report.SetPhase(Phases.Next());
            report.SetTaskAttemptState(TaskAttemptStates.Next());
            report.SetProgress((float)Math.Random());
            report.SetCounters(TypeConverter.ToYarn(NewCounters()));
            report.SetContainerId(containerId);
            report.SetDiagnosticInfo(Diags.Next());
            report.SetStateString("Moving average " + Math.Random());
            return(report);
        }