示例#1
0
        private void ConstructTaskReport()
        {
            LoadAllTaskAttempts();
            this.report = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <TaskReport>();
            report.SetTaskId(taskId);
            long minLaunchTime = long.MaxValue;

            foreach (TaskAttempt attempt in attempts.Values)
            {
                minLaunchTime = Math.Min(minLaunchTime, attempt.GetLaunchTime());
            }
            minLaunchTime = minLaunchTime == long.MaxValue ? -1 : minLaunchTime;
            report.SetStartTime(minLaunchTime);
            report.SetFinishTime(taskInfo.GetFinishTime());
            report.SetTaskState(GetState());
            report.SetProgress(GetProgress());
            Counters counters = GetCounters();

            if (counters == null)
            {
                counters = EmptyCounters;
            }
            report.SetCounters(TypeConverter.ToYarn(counters));
            if (successfulAttempt != null)
            {
                report.SetSuccessfulAttempt(successfulAttempt);
            }
            report.AddAllDiagnostics(reportDiagnostics);
            report.AddAllRunningAttempts(new AList <TaskAttemptId>(attempts.Keys));
        }