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)); }
public static TaskReport NewTaskReport(TaskId id) { TaskReport report = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <TaskReport>(); report.SetTaskId(id); report.SetStartTime(Runtime.CurrentTimeMillis() - (int)(Math.Random() * Dt)); report.SetFinishTime(Runtime.CurrentTimeMillis() + (int)(Math.Random() * Dt) + 1); report.SetProgress((float)Math.Random()); report.SetStatus("Moving average: " + Math.Random()); report.SetCounters(TypeConverter.ToYarn(NewCounters())); report.SetTaskState(TaskStates.Next()); return(report); }