public virtual void TestTaskAttemptUnsuccessfulCompletionWithoutCounters0239() { Path histPath = new Path(GetType().GetClassLoader().GetResource("job_0.23.9-FAILED.jhist" ).GetFile()); JobHistoryParser parser = new JobHistoryParser(FileSystem.GetLocal(new Configuration ()), histPath); JobHistoryParser.JobInfo jobInfo = parser.Parse(); Log.Info(" job info: " + jobInfo.GetJobname() + " " + jobInfo.GetFinishedMaps() + " " + jobInfo.GetTotalMaps() + " " + jobInfo.GetJobId()); }
// Computes finished maps similar to RecoveryService... private long ComputeFinishedMaps(JobHistoryParser.JobInfo jobInfo, int numMaps, int numSuccessfulMaps) { if (numMaps == numSuccessfulMaps) { return(jobInfo.GetFinishedMaps()); } long numFinishedMaps = 0; IDictionary <TaskID, JobHistoryParser.TaskInfo> taskInfos = jobInfo.GetAllTasks(); foreach (JobHistoryParser.TaskInfo taskInfo in taskInfos.Values) { if (TaskState.Succeeded.ToString().Equals(taskInfo.GetTaskStatus())) { ++numFinishedMaps; } } return(numFinishedMaps); }
//History data is leisurely loaded when task level data is requested /// <exception cref="System.IO.IOException"/> protected internal virtual void LoadFullHistoryData(bool loadTasks, Path historyFileAbsolute ) { lock (this) { Log.Info("Loading history file: [" + historyFileAbsolute + "]"); if (this.jobInfo != null) { return; } if (historyFileAbsolute != null) { JobHistoryParser parser = null; try { parser = new JobHistoryParser(historyFileAbsolute.GetFileSystem(conf), historyFileAbsolute ); this.jobInfo = parser.Parse(); } catch (IOException e) { throw new YarnRuntimeException("Could not load history file " + historyFileAbsolute , e); } IOException parseException = parser.GetParseException(); if (parseException != null) { throw new YarnRuntimeException("Could not parse history file " + historyFileAbsolute , parseException); } } else { throw new IOException("History file not found"); } if (loadTasks) { LoadAllTasks(); Log.Info("TaskInfo loaded"); } } }
public virtual void TestFailedJobHistoryWithoutDiagnostics() { Path histPath = new Path(GetType().GetClassLoader().GetResource("job_1393307629410_0001-1393307687476-user-Sleep+job-1393307723835-0-0-FAILED-default-1393307693920.jhist" ).GetFile()); FileSystem lfs = FileSystem.GetLocal(new Configuration()); FSDataInputStream fsdis = lfs.Open(histPath); try { JobHistoryParser parser = new JobHistoryParser(fsdis); JobHistoryParser.JobInfo info = parser.Parse(); NUnit.Framework.Assert.AreEqual("History parsed jobId incorrectly", info.GetJobId (), JobID.ForName("job_1393307629410_0001")); NUnit.Framework.Assert.AreEqual("Default diagnostics incorrect ", string.Empty, info .GetErrorInfo()); } finally { fsdis.Close(); } }
public virtual void TestMultipleFailedTasks() { JobHistoryParser parser = new JobHistoryParser(Org.Mockito.Mockito.Mock <FSDataInputStream >()); EventReader reader = Org.Mockito.Mockito.Mock <EventReader>(); AtomicInteger numEventsRead = new AtomicInteger(0); // Hack! TaskType taskType = TaskType.Map; TaskID[] tids = new TaskID[2]; JobID jid = new JobID("1", 1); tids[0] = new TaskID(jid, taskType, 0); tids[1] = new TaskID(jid, taskType, 1); Org.Mockito.Mockito.When(reader.GetNextEvent()).ThenAnswer(new _Answer_842(numEventsRead , tids, taskType, jid)); // send two task start and two task fail events for tasks 0 and 1 JobHistoryParser.JobInfo info = parser.Parse(reader); NUnit.Framework.Assert.IsTrue("Task 0 not implicated", info.GetErrorInfo().Contains (tids[0].ToString())); }
/// <exception cref="System.Exception"/> public virtual void TestJobInfo() { JobHistoryParser.JobInfo info = new JobHistoryParser.JobInfo(); NUnit.Framework.Assert.AreEqual("NORMAL", info.GetPriority()); info.PrintAll(); }