Ejemplo n.º 1
0
 /// <exception cref="System.Exception"/>
 public virtual void TestScanningOldDirs()
 {
     Log.Info("STARTING testScanningOldDirs");
     try
     {
         Configuration conf = new Configuration();
         conf.SetClass(CommonConfigurationKeysPublic.NetTopologyNodeSwitchMappingImplKey,
                       typeof(TestJobHistoryParsing.MyResolver), typeof(DNSToSwitchMapping));
         RackResolver.Init(conf);
         MRApp app = new TestJobHistoryEvents.MRAppWithHistory(1, 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();
         Log.Info("JOBID is " + TypeConverter.FromYarn(jobId).ToString());
         app.WaitForState(job, JobState.Succeeded);
         // make sure all events are flushed
         app.WaitForState(Service.STATE.Stopped);
         TestJobHistoryParsing.HistoryFileManagerForTest hfm = new TestJobHistoryParsing.HistoryFileManagerForTest
                                                                   ();
         hfm.Init(conf);
         HistoryFileManager.HistoryFileInfo fileInfo = hfm.GetFileInfo(jobId);
         NUnit.Framework.Assert.IsNotNull("Unable to locate job history", fileInfo);
         // force the manager to "forget" the job
         hfm.DeleteJobFromJobListCache(fileInfo);
         int msecPerSleep = 10;
         int msecToSleep  = 10 * 1000;
         while (fileInfo.IsMovePending() && msecToSleep > 0)
         {
             NUnit.Framework.Assert.IsTrue(!fileInfo.DidMoveFail());
             msecToSleep -= msecPerSleep;
             Sharpen.Thread.Sleep(msecPerSleep);
         }
         NUnit.Framework.Assert.IsTrue("Timeout waiting for history move", msecToSleep > 0
                                       );
         fileInfo = hfm.GetFileInfo(jobId);
         hfm.Stop();
         NUnit.Framework.Assert.IsNotNull("Unable to locate old job history", fileInfo);
         NUnit.Framework.Assert.IsTrue("HistoryFileManager not shutdown properly", hfm.moveToDoneExecutor
                                       .IsTerminated());
     }
     finally
     {
         Log.Info("FINISHED testScanningOldDirs");
     }
 }
Ejemplo n.º 2
0
        public virtual void TestHistoryFileInfoSummaryFileNotExist()
        {
            TestHistoryFileManager.HistoryFileManagerTest hmTest = new TestHistoryFileManager.HistoryFileManagerTest
                                                                       ();
            string       job          = "job_1410889000000_123456";
            Path         summaryFile  = new Path(job + ".summary");
            JobIndexInfo jobIndexInfo = new JobIndexInfo();

            jobIndexInfo.SetJobId(TypeConverter.ToYarn(JobID.ForName(job)));
            Configuration conf = dfsCluster.GetConfiguration(0);

            conf.Set(JHAdminConfig.MrHistoryDoneDir, "/" + UUID.RandomUUID());
            conf.Set(JHAdminConfig.MrHistoryIntermediateDoneDir, "/" + UUID.RandomUUID());
            hmTest.ServiceInit(conf);
            HistoryFileManager.HistoryFileInfo info = hmTest.GetHistoryFileInfo(null, null, summaryFile
                                                                                , jobIndexInfo, false);
            info.MoveToDone();
            NUnit.Framework.Assert.IsFalse(info.DidMoveFail());
        }