示例#1
0
        public virtual void TestRefreshLoadedJobCache()
        {
            HistoryFileManager historyManager = Org.Mockito.Mockito.Mock <HistoryFileManager>(
                );

            jobHistory = Org.Mockito.Mockito.Spy(new JobHistory());
            Org.Mockito.Mockito.DoReturn(historyManager).When(jobHistory).CreateHistoryFileManager
                ();
            Configuration conf = new Configuration();

            // Set the cache size to 2
            conf.Set(JHAdminConfig.MrHistoryLoadedJobCacheSize, "2");
            jobHistory.Init(conf);
            jobHistory.Start();
            CachedHistoryStorage storage = Org.Mockito.Mockito.Spy((CachedHistoryStorage)jobHistory
                                                                   .GetHistoryStorage());

            Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job[] jobs = new Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job
                                                                [3];
            JobId[] jobIds = new JobId[3];
            for (int i = 0; i < 3; i++)
            {
                jobs[i]   = Org.Mockito.Mockito.Mock <Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job>();
                jobIds[i] = Org.Mockito.Mockito.Mock <JobId>();
                Org.Mockito.Mockito.When(jobs[i].GetID()).ThenReturn(jobIds[i]);
            }
            HistoryFileManager.HistoryFileInfo fileInfo = Org.Mockito.Mockito.Mock <HistoryFileManager.HistoryFileInfo
                                                                                    >();
            Org.Mockito.Mockito.When(historyManager.GetFileInfo(Any <JobId>())).ThenReturn(fileInfo
                                                                                           );
            Org.Mockito.Mockito.When(fileInfo.LoadJob()).ThenReturn(jobs[0]).ThenReturn(jobs[
                                                                                            1]).ThenReturn(jobs[2]);
            // getFullJob will put the job in the cache if it isn't there
            for (int i_1 = 0; i_1 < 3; i_1++)
            {
                storage.GetFullJob(jobs[i_1].GetID());
            }
            IDictionary <JobId, Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job> jobCache = storage
                                                                                       .GetLoadedJobCache();

            // job0 should have been purged since cache size is 2
            NUnit.Framework.Assert.IsFalse(jobCache.Contains(jobs[0].GetID()));
            NUnit.Framework.Assert.IsTrue(jobCache.Contains(jobs[1].GetID()) && jobCache.Contains
                                              (jobs[2].GetID()));
            // Setting cache size to 3
            conf.Set(JHAdminConfig.MrHistoryLoadedJobCacheSize, "3");
            Org.Mockito.Mockito.DoReturn(conf).When(storage).CreateConf();
            Org.Mockito.Mockito.When(fileInfo.LoadJob()).ThenReturn(jobs[0]).ThenReturn(jobs[
                                                                                            1]).ThenReturn(jobs[2]);
            jobHistory.RefreshLoadedJobCache();
            for (int i_2 = 0; i_2 < 3; i_2++)
            {
                storage.GetFullJob(jobs[i_2].GetID());
            }
            jobCache = storage.GetLoadedJobCache();
            // All three jobs should be in cache since its size is now 3
            for (int i_3 = 0; i_3 < 3; i_3++)
            {
                NUnit.Framework.Assert.IsTrue(jobCache.Contains(jobs[i_3].GetID()));
            }
        }
示例#2
0
        public virtual void TestRefreshJobRetentionSettings()
        {
            string root              = "mockfs://foo/";
            string historyDoneDir    = root + "mapred/history/done";
            long   now               = Runtime.CurrentTimeMillis();
            long   someTimeYesterday = now - (25l * 3600 * 1000);
            long   timeBefore200Secs = now - (200l * 1000);
            // Get yesterday's date in YY/MM/DD format
            string timestampComponent = JobHistoryUtils.TimestampDirectoryComponent(someTimeYesterday
                                                                                    );
            // Create a folder under yesterday's done dir
            Path donePathYesterday = new Path(historyDoneDir, timestampComponent + "/" + "000000"
                                              );
            FileStatus dirCreatedYesterdayStatus = new FileStatus(0, true, 0, 0, someTimeYesterday
                                                                  , donePathYesterday);

            // Get today's date in YY/MM/DD format
            timestampComponent = JobHistoryUtils.TimestampDirectoryComponent(timeBefore200Secs
                                                                             );
            // Create a folder under today's done dir
            Path donePathToday = new Path(historyDoneDir, timestampComponent + "/" + "000000"
                                          );
            FileStatus dirCreatedTodayStatus = new FileStatus(0, true, 0, 0, timeBefore200Secs
                                                              , donePathToday);
            // Create a jhist file with yesterday's timestamp under yesterday's done dir
            Path fileUnderYesterdayDir = new Path(donePathYesterday.ToString(), "job_1372363578825_0015-"
                                                  + someTimeYesterday + "-user-Sleep+job-" + someTimeYesterday + "-1-1-SUCCEEDED-default.jhist"
                                                  );
            FileStatus fileUnderYesterdayDirStatus = new FileStatus(10, false, 0, 0, someTimeYesterday
                                                                    , fileUnderYesterdayDir);
            // Create a jhist file with today's timestamp under today's done dir
            Path fileUnderTodayDir = new Path(donePathYesterday.ToString(), "job_1372363578825_0016-"
                                              + timeBefore200Secs + "-user-Sleep+job-" + timeBefore200Secs + "-1-1-SUCCEEDED-default.jhist"
                                              );
            FileStatus fileUnderTodayDirStatus = new FileStatus(10, false, 0, 0, timeBefore200Secs
                                                                , fileUnderTodayDir);
            HistoryFileManager historyManager = Org.Mockito.Mockito.Spy(new HistoryFileManager
                                                                            ());

            jobHistory = Org.Mockito.Mockito.Spy(new JobHistory());
            IList <FileStatus> fileStatusList = new List <FileStatus>();

            fileStatusList.AddItem(dirCreatedYesterdayStatus);
            fileStatusList.AddItem(dirCreatedTodayStatus);
            // Make the initial delay of history job cleaner as 4 secs
            Org.Mockito.Mockito.DoReturn(4).When(jobHistory).GetInitDelaySecs();
            Org.Mockito.Mockito.DoReturn(historyManager).When(jobHistory).CreateHistoryFileManager
                ();
            IList <FileStatus> list1 = new List <FileStatus>();

            list1.AddItem(fileUnderYesterdayDirStatus);
            Org.Mockito.Mockito.DoReturn(list1).When(historyManager).ScanDirectoryForHistoryFiles
                (Eq(donePathYesterday), Any <FileContext>());
            IList <FileStatus> list2 = new List <FileStatus>();

            list2.AddItem(fileUnderTodayDirStatus);
            Org.Mockito.Mockito.DoReturn(list2).When(historyManager).ScanDirectoryForHistoryFiles
                (Eq(donePathToday), Any <FileContext>());
            Org.Mockito.Mockito.DoReturn(fileStatusList).When(historyManager).GetHistoryDirsForCleaning
                (Org.Mockito.Mockito.AnyLong());
            Org.Mockito.Mockito.DoReturn(true).When(historyManager).DeleteDir(Any <FileStatus>
                                                                                  ());
            HistoryFileManager.JobListCache jobListCache = Org.Mockito.Mockito.Mock <HistoryFileManager.JobListCache
                                                                                     >();
            HistoryFileManager.HistoryFileInfo fileInfo = Org.Mockito.Mockito.Mock <HistoryFileManager.HistoryFileInfo
                                                                                    >();
            Org.Mockito.Mockito.DoReturn(jobListCache).When(historyManager).CreateJobListCache
                ();
            Org.Mockito.Mockito.When(jobListCache.Get(Any <JobId>())).ThenReturn(fileInfo);
            Org.Mockito.Mockito.DoNothing().When(fileInfo).Delete();
            // Set job retention time to 24 hrs and cleaner interval to 2 secs
            Configuration conf = new Configuration();

            conf.SetLong(JHAdminConfig.MrHistoryMaxAgeMs, 24l * 3600 * 1000);
            conf.SetLong(JHAdminConfig.MrHistoryCleanerIntervalMs, 2 * 1000);
            jobHistory.Init(conf);
            jobHistory.Start();
            NUnit.Framework.Assert.AreEqual(2 * 1000l, jobHistory.GetCleanerInterval());
            // Only yesterday's jhist file should get deleted
            Org.Mockito.Mockito.Verify(fileInfo, Org.Mockito.Mockito.Timeout(20000).Times(1))
            .Delete();
            fileStatusList.Remove(dirCreatedYesterdayStatus);
            // Now reset job retention time to 10 secs
            conf.SetLong(JHAdminConfig.MrHistoryMaxAgeMs, 10 * 1000);
            // Set cleaner interval to 1 sec
            conf.SetLong(JHAdminConfig.MrHistoryCleanerIntervalMs, 1 * 1000);
            Org.Mockito.Mockito.DoReturn(conf).When(jobHistory).CreateConf();
            // Do refresh job retention settings
            jobHistory.RefreshJobRetentionSettings();
            // Cleaner interval should be updated
            NUnit.Framework.Assert.AreEqual(1 * 1000l, jobHistory.GetCleanerInterval());
            // Today's jhist file will also be deleted now since it falls below the
            // retention threshold
            Org.Mockito.Mockito.Verify(fileInfo, Org.Mockito.Mockito.Timeout(20000).Times(2))
            .Delete();
        }
示例#3
0
 internal HistoryCleaner(JobHistory _enclosing)
 {
     this._enclosing = _enclosing;
 }
示例#4
0
 internal MoveIntermediateToDoneRunnable(JobHistory _enclosing)
 {
     this._enclosing = _enclosing;
 }
示例#5
0
 /// <exception cref="System.Exception"/>
 public virtual void TestDiagnosticsForKilledJob()
 {
     Log.Info("STARTING testDiagnosticsForKilledJob");
     try
     {
         Configuration conf = new Configuration();
         conf.SetClass(CommonConfigurationKeysPublic.NetTopologyNodeSwitchMappingImplKey,
                       typeof(TestJobHistoryParsing.MyResolver), typeof(DNSToSwitchMapping));
         RackResolver.Init(conf);
         MRApp app = new TestJobHistoryParsing.MRAppWithHistoryWithJobKilled(2, 1, true, this
                                                                             .GetType().FullName, true);
         app.Submit(conf);
         Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job = app.GetContext().GetAllJobs().Values
                                                          .GetEnumerator().Next();
         JobId jobId = job.GetID();
         app.WaitForState(job, JobState.Killed);
         // make sure all events are flushed
         app.WaitForState(Service.STATE.Stopped);
         JobHistory jobHistory = new JobHistory();
         jobHistory.Init(conf);
         HistoryFileManager.HistoryFileInfo fileInfo = jobHistory.GetJobFileInfo(jobId);
         JobHistoryParser         parser;
         JobHistoryParser.JobInfo jobInfo;
         lock (fileInfo)
         {
             Path historyFilePath  = fileInfo.GetHistoryFile();
             FSDataInputStream @in = null;
             FileContext       fc  = null;
             try
             {
                 fc  = FileContext.GetFileContext(conf);
                 @in = fc.Open(fc.MakeQualified(historyFilePath));
             }
             catch (IOException ioe)
             {
                 Log.Info("Can not open history file: " + historyFilePath, ioe);
                 throw (new Exception("Can not open History File"));
             }
             parser  = new JobHistoryParser(@in);
             jobInfo = parser.Parse();
         }
         Exception parseException = parser.GetParseException();
         NUnit.Framework.Assert.IsNull("Caught an expected exception " + parseException, parseException
                                       );
         IList <string> originalDiagnostics = job.GetDiagnostics();
         string         historyError        = jobInfo.GetErrorInfo();
         NUnit.Framework.Assert.IsTrue("No original diagnostics for a failed job", originalDiagnostics
                                       != null && !originalDiagnostics.IsEmpty());
         NUnit.Framework.Assert.IsNotNull("No history error info for a failed job ", historyError
                                          );
         foreach (string diagString in originalDiagnostics)
         {
             NUnit.Framework.Assert.IsTrue(historyError.Contains(diagString));
         }
         NUnit.Framework.Assert.IsTrue("No killed message in diagnostics", historyError.Contains
                                           (JobImpl.JobKilledDiag));
     }
     finally
     {
         Log.Info("FINISHED testDiagnosticsForKilledJob");
     }
 }
示例#6
0
 /// <exception cref="System.Exception"/>
 public virtual void TestHistoryParsingForFailedAttempts()
 {
     Log.Info("STARTING testHistoryParsingForFailedAttempts");
     try
     {
         Configuration conf = new Configuration();
         conf.SetClass(CommonConfigurationKeysPublic.NetTopologyNodeSwitchMappingImplKey,
                       typeof(TestJobHistoryParsing.MyResolver), typeof(DNSToSwitchMapping));
         RackResolver.Init(conf);
         MRApp app = new TestJobHistoryParsing.MRAppWithHistoryWithFailedAttempt(2, 1, true
                                                                                 , this.GetType().FullName, true);
         app.Submit(conf);
         Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job = app.GetContext().GetAllJobs().Values
                                                          .GetEnumerator().Next();
         JobId jobId = job.GetID();
         app.WaitForState(job, JobState.Succeeded);
         // make sure all events are flushed
         app.WaitForState(Service.STATE.Stopped);
         JobHistory jobHistory = new JobHistory();
         jobHistory.Init(conf);
         HistoryFileManager.HistoryFileInfo fileInfo = jobHistory.GetJobFileInfo(jobId);
         JobHistoryParser         parser;
         JobHistoryParser.JobInfo jobInfo;
         lock (fileInfo)
         {
             Path historyFilePath  = fileInfo.GetHistoryFile();
             FSDataInputStream @in = null;
             FileContext       fc  = null;
             try
             {
                 fc  = FileContext.GetFileContext(conf);
                 @in = fc.Open(fc.MakeQualified(historyFilePath));
             }
             catch (IOException ioe)
             {
                 Log.Info("Can not open history file: " + historyFilePath, ioe);
                 throw (new Exception("Can not open History File"));
             }
             parser  = new JobHistoryParser(@in);
             jobInfo = parser.Parse();
         }
         Exception parseException = parser.GetParseException();
         NUnit.Framework.Assert.IsNull("Caught an expected exception " + parseException, parseException
                                       );
         int noOffailedAttempts = 0;
         IDictionary <TaskID, JobHistoryParser.TaskInfo> allTasks = jobInfo.GetAllTasks();
         foreach (Task task in job.GetTasks().Values)
         {
             JobHistoryParser.TaskInfo taskInfo = allTasks[TypeConverter.FromYarn(task.GetID()
                                                                                  )];
             foreach (TaskAttempt taskAttempt in task.GetAttempts().Values)
             {
                 JobHistoryParser.TaskAttemptInfo taskAttemptInfo = taskInfo.GetAllTaskAttempts()[
                     TypeConverter.FromYarn((taskAttempt.GetID()))];
                 // Verify rack-name for all task attempts
                 NUnit.Framework.Assert.AreEqual("rack-name is incorrect", taskAttemptInfo.GetRackname
                                                     (), RackName);
                 if (taskAttemptInfo.GetTaskStatus().Equals("FAILED"))
                 {
                     noOffailedAttempts++;
                 }
             }
         }
         NUnit.Framework.Assert.AreEqual("No of Failed tasks doesn't match.", 2, noOffailedAttempts
                                         );
     }
     finally
     {
         Log.Info("FINISHED testHistoryParsingForFailedAttempts");
     }
 }
示例#7
0
        /// <exception cref="System.Exception"/>
        private void CheckHistoryParsing(int numMaps, int numReduces, int numSuccessfulMaps
                                         )
        {
            Configuration conf = new Configuration();

            conf.Set(MRJobConfig.UserName, Runtime.GetProperty("user.name"));
            long amStartTimeEst = Runtime.CurrentTimeMillis();

            conf.SetClass(CommonConfigurationKeysPublic.NetTopologyNodeSwitchMappingImplKey,
                          typeof(TestJobHistoryParsing.MyResolver), typeof(DNSToSwitchMapping));
            RackResolver.Init(conf);
            MRApp app = new TestJobHistoryEvents.MRAppWithHistory(numMaps, numReduces, true,
                                                                  this.GetType().FullName, true);

            app.Submit(conf);
            Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job = app.GetContext().GetAllJobs().Values
                                                             .GetEnumerator().Next();
            JobId jobId = job.GetID();

            Log.Info("JOBID is " + TypeConverter.FromYarn(jobId).ToString());
            app.WaitForState(job, JobState.Succeeded);
            // make sure all events are flushed
            app.WaitForState(Service.STATE.Stopped);
            string      jobhistoryDir = JobHistoryUtils.GetHistoryIntermediateDoneDirForUser(conf);
            FileContext fc            = null;

            try
            {
                fc = FileContext.GetFileContext(conf);
            }
            catch (IOException ioe)
            {
                Log.Info("Can not get FileContext", ioe);
                throw (new Exception("Can not get File Context"));
            }
            if (numMaps == numSuccessfulMaps)
            {
                string summaryFileName  = JobHistoryUtils.GetIntermediateSummaryFileName(jobId);
                Path   summaryFile      = new Path(jobhistoryDir, summaryFileName);
                string jobSummaryString = GetJobSummary(fc, summaryFile);
                NUnit.Framework.Assert.IsNotNull(jobSummaryString);
                NUnit.Framework.Assert.IsTrue(jobSummaryString.Contains("resourcesPerMap=100"));
                NUnit.Framework.Assert.IsTrue(jobSummaryString.Contains("resourcesPerReduce=100")
                                              );
                IDictionary <string, string> jobSummaryElements = new Dictionary <string, string>();
                StringTokenizer strToken = new StringTokenizer(jobSummaryString, ",");
                while (strToken.HasMoreTokens())
                {
                    string keypair = strToken.NextToken();
                    jobSummaryElements[keypair.Split("=")[0]] = keypair.Split("=")[1];
                }
                NUnit.Framework.Assert.AreEqual("JobId does not match", jobId.ToString(), jobSummaryElements
                                                ["jobId"]);
                NUnit.Framework.Assert.AreEqual("JobName does not match", "test", jobSummaryElements
                                                ["jobName"]);
                NUnit.Framework.Assert.IsTrue("submitTime should not be 0", long.Parse(jobSummaryElements
                                                                                       ["submitTime"]) != 0);
                NUnit.Framework.Assert.IsTrue("launchTime should not be 0", long.Parse(jobSummaryElements
                                                                                       ["launchTime"]) != 0);
                NUnit.Framework.Assert.IsTrue("firstMapTaskLaunchTime should not be 0", long.Parse
                                                  (jobSummaryElements["firstMapTaskLaunchTime"]) != 0);
                NUnit.Framework.Assert.IsTrue("firstReduceTaskLaunchTime should not be 0", long.Parse
                                                  (jobSummaryElements["firstReduceTaskLaunchTime"]) != 0);
                NUnit.Framework.Assert.IsTrue("finishTime should not be 0", long.Parse(jobSummaryElements
                                                                                       ["finishTime"]) != 0);
                NUnit.Framework.Assert.AreEqual("Mismatch in num map slots", numSuccessfulMaps, System.Convert.ToInt32
                                                    (jobSummaryElements["numMaps"]));
                NUnit.Framework.Assert.AreEqual("Mismatch in num reduce slots", numReduces, System.Convert.ToInt32
                                                    (jobSummaryElements["numReduces"]));
                NUnit.Framework.Assert.AreEqual("User does not match", Runtime.GetProperty("user.name"
                                                                                           ), jobSummaryElements["user"]);
                NUnit.Framework.Assert.AreEqual("Queue does not match", "default", jobSummaryElements
                                                ["queue"]);
                NUnit.Framework.Assert.AreEqual("Status does not match", "SUCCEEDED", jobSummaryElements
                                                ["status"]);
            }
            JobHistory jobHistory = new JobHistory();

            jobHistory.Init(conf);
            HistoryFileManager.HistoryFileInfo fileInfo = jobHistory.GetJobFileInfo(jobId);
            JobHistoryParser.JobInfo           jobInfo;
            long numFinishedMaps;

            lock (fileInfo)
            {
                Path historyFilePath  = fileInfo.GetHistoryFile();
                FSDataInputStream @in = null;
                Log.Info("JobHistoryFile is: " + historyFilePath);
                try
                {
                    @in = fc.Open(fc.MakeQualified(historyFilePath));
                }
                catch (IOException ioe)
                {
                    Log.Info("Can not open history file: " + historyFilePath, ioe);
                    throw (new Exception("Can not open History File"));
                }
                JobHistoryParser parser     = new JobHistoryParser(@in);
                EventReader      realReader = new EventReader(@in);
                EventReader      reader     = Org.Mockito.Mockito.Mock <EventReader>();
                if (numMaps == numSuccessfulMaps)
                {
                    reader = realReader;
                }
                else
                {
                    AtomicInteger numFinishedEvents = new AtomicInteger(0);
                    // Hack!
                    Org.Mockito.Mockito.When(reader.GetNextEvent()).ThenAnswer(new _Answer_257(realReader
                                                                                               , numFinishedEvents, numSuccessfulMaps));
                }
                jobInfo         = parser.Parse(reader);
                numFinishedMaps = ComputeFinishedMaps(jobInfo, numMaps, numSuccessfulMaps);
                if (numFinishedMaps != numMaps)
                {
                    Exception parseException = parser.GetParseException();
                    NUnit.Framework.Assert.IsNotNull("Didn't get expected parse exception", parseException
                                                     );
                }
            }
            NUnit.Framework.Assert.AreEqual("Incorrect username ", Runtime.GetProperty("user.name"
                                                                                       ), jobInfo.GetUsername());
            NUnit.Framework.Assert.AreEqual("Incorrect jobName ", "test", jobInfo.GetJobname(
                                                ));
            NUnit.Framework.Assert.AreEqual("Incorrect queuename ", "default", jobInfo.GetJobQueueName
                                                ());
            NUnit.Framework.Assert.AreEqual("incorrect conf path", "test", jobInfo.GetJobConfPath
                                                ());
            NUnit.Framework.Assert.AreEqual("incorrect finishedMap ", numSuccessfulMaps, numFinishedMaps
                                            );
            NUnit.Framework.Assert.AreEqual("incorrect finishedReduces ", numReduces, jobInfo
                                            .GetFinishedReduces());
            NUnit.Framework.Assert.AreEqual("incorrect uberized ", job.IsUber(), jobInfo.GetUberized
                                                ());
            IDictionary <TaskID, JobHistoryParser.TaskInfo> allTasks = jobInfo.GetAllTasks();
            int totalTasks = allTasks.Count;

            NUnit.Framework.Assert.AreEqual("total number of tasks is incorrect  ", (numMaps
                                                                                     + numReduces), totalTasks);
            // Verify aminfo
            NUnit.Framework.Assert.AreEqual(1, jobInfo.GetAMInfos().Count);
            NUnit.Framework.Assert.AreEqual(MRApp.NmHost, jobInfo.GetAMInfos()[0].GetNodeManagerHost
                                                ());
            JobHistoryParser.AMInfo amInfo = jobInfo.GetAMInfos()[0];
            NUnit.Framework.Assert.AreEqual(MRApp.NmPort, amInfo.GetNodeManagerPort());
            NUnit.Framework.Assert.AreEqual(MRApp.NmHttpPort, amInfo.GetNodeManagerHttpPort()
                                            );
            NUnit.Framework.Assert.AreEqual(1, amInfo.GetAppAttemptId().GetAttemptId());
            NUnit.Framework.Assert.AreEqual(amInfo.GetAppAttemptId(), amInfo.GetContainerId()
                                            .GetApplicationAttemptId());
            NUnit.Framework.Assert.IsTrue(amInfo.GetStartTime() <= Runtime.CurrentTimeMillis(
                                              ) && amInfo.GetStartTime() >= amStartTimeEst);
            ContainerId fakeCid = MRApp.NewContainerId(-1, -1, -1, -1);

            // Assert at taskAttempt level
            foreach (JobHistoryParser.TaskInfo taskInfo in allTasks.Values)
            {
                int taskAttemptCount = taskInfo.GetAllTaskAttempts().Count;
                NUnit.Framework.Assert.AreEqual("total number of task attempts ", 1, taskAttemptCount
                                                );
                JobHistoryParser.TaskAttemptInfo taInfo = taskInfo.GetAllTaskAttempts().Values.GetEnumerator
                                                              ().Next();
                NUnit.Framework.Assert.IsNotNull(taInfo.GetContainerId());
                // Verify the wrong ctor is not being used. Remove after mrv1 is removed.
                NUnit.Framework.Assert.IsFalse(taInfo.GetContainerId().Equals(fakeCid));
            }
            // Deep compare Job and JobInfo
            foreach (Task task in job.GetTasks().Values)
            {
                JobHistoryParser.TaskInfo taskInfo_1 = allTasks[TypeConverter.FromYarn(task.GetID
                                                                                           ())];
                NUnit.Framework.Assert.IsNotNull("TaskInfo not found", taskInfo_1);
                foreach (TaskAttempt taskAttempt in task.GetAttempts().Values)
                {
                    JobHistoryParser.TaskAttemptInfo taskAttemptInfo = taskInfo_1.GetAllTaskAttempts(
                        )[TypeConverter.FromYarn((taskAttempt.GetID()))];
                    NUnit.Framework.Assert.IsNotNull("TaskAttemptInfo not found", taskAttemptInfo);
                    NUnit.Framework.Assert.AreEqual("Incorrect shuffle port for task attempt", taskAttempt
                                                    .GetShufflePort(), taskAttemptInfo.GetShufflePort());
                    if (numMaps == numSuccessfulMaps)
                    {
                        NUnit.Framework.Assert.AreEqual(MRApp.NmHost, taskAttemptInfo.GetHostname());
                        NUnit.Framework.Assert.AreEqual(MRApp.NmPort, taskAttemptInfo.GetPort());
                        // Verify rack-name
                        NUnit.Framework.Assert.AreEqual("rack-name is incorrect", taskAttemptInfo.GetRackname
                                                            (), RackName);
                    }
                }
            }
            // test output for HistoryViewer
            TextWriter stdps = System.Console.Out;

            try
            {
                Runtime.SetOut(new TextWriter(outContent));
                HistoryViewer viewer;
                lock (fileInfo)
                {
                    viewer = new HistoryViewer(fc.MakeQualified(fileInfo.GetHistoryFile()).ToString()
                                               , conf, true);
                }
                viewer.Print();
                foreach (JobHistoryParser.TaskInfo taskInfo_1 in allTasks.Values)
                {
                    string test = (taskInfo_1.GetTaskStatus() == null ? string.Empty : taskInfo_1.GetTaskStatus
                                       ()) + " " + taskInfo_1.GetTaskType() + " task list for " + taskInfo_1.GetTaskId(
                        ).GetJobID();
                    NUnit.Framework.Assert.IsTrue(outContent.ToString().IndexOf(test) > 0);
                    NUnit.Framework.Assert.IsTrue(outContent.ToString().IndexOf(taskInfo_1.GetTaskId(
                                                                                    ).ToString()) > 0);
                }
            }
            finally
            {
                Runtime.SetOut(stdps);
            }
        }