/// <exception cref="System.IO.IOException"/>
 private static MockHistoryJobs.JobsPair Split(IDictionary <JobId, Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job
                                                            > mocked)
 {
     MockHistoryJobs.JobsPair ret = new MockHistoryJobs.JobsPair();
     ret.full    = Maps.NewHashMap();
     ret.partial = Maps.NewHashMap();
     foreach (KeyValuePair <JobId, Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job> entry in
              mocked)
     {
         JobId id = entry.Key;
         Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job j       = entry.Value;
         MockHistoryJobs.MockCompletedJob           mockJob = new MockHistoryJobs.MockCompletedJob(j
                                                                                                   );
         // use MockCompletedJob to set everything below to make sure
         // consistent with what history server would do
         ret.full[id] = mockJob;
         JobReport    report = mockJob.GetReport();
         JobIndexInfo info   = new JobIndexInfo(report.GetStartTime(), report.GetFinishTime(
                                                    ), mockJob.GetUserName(), mockJob.GetName(), id, mockJob.GetCompletedMaps(), mockJob
                                                .GetCompletedReduces(), mockJob.GetState().ToString());
         info.SetJobStartTime(report.GetStartTime());
         info.SetQueueName(mockJob.GetQueueName());
         ret.partial[id] = new PartialJob(info, id);
     }
     return(ret);
 }
Exemple #2
0
 public PartialJob(JobIndexInfo jobIndexInfo, JobId jobId)
 {
     this.jobIndexInfo = jobIndexInfo;
     this.jobId        = jobId;
     jobReport         = RecordFactoryProvider.GetRecordFactory(null).NewRecordInstance <JobReport
                                                                                         >();
     jobReport.SetSubmitTime(jobIndexInfo.GetSubmitTime());
     jobReport.SetStartTime(jobIndexInfo.GetJobStartTime());
     jobReport.SetFinishTime(jobIndexInfo.GetFinishTime());
     jobReport.SetJobState(GetState());
 }
        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());
        }
Exemple #4
0
        /// <summary>Simple test PartialJob</summary>
        /// <exception cref="System.Exception"/>
        public virtual void TestPartialJob()
        {
            JobId jobId = new JobIdPBImpl();

            jobId.SetId(0);
            JobIndexInfo jii = new JobIndexInfo(0L, Runtime.CurrentTimeMillis(), "user", "jobName"
                                                , jobId, 3, 2, "JobStatus");
            PartialJob test = new PartialJob(jii, jobId);

            NUnit.Framework.Assert.AreEqual(1.0f, test.GetProgress(), 0.001);
            NUnit.Framework.Assert.IsNull(test.GetAllCounters());
            NUnit.Framework.Assert.IsNull(test.GetTasks());
            NUnit.Framework.Assert.IsNull(test.GetTasks(TaskType.Map));
            NUnit.Framework.Assert.IsNull(test.GetTask(new TaskIdPBImpl()));
            NUnit.Framework.Assert.IsNull(test.GetTaskAttemptCompletionEvents(0, 100));
            NUnit.Framework.Assert.IsNull(test.GetMapAttemptCompletionEvents(0, 100));
            NUnit.Framework.Assert.IsTrue(test.CheckAccess(UserGroupInformation.GetCurrentUser
                                                               (), null));
            NUnit.Framework.Assert.IsNull(test.GetAMInfos());
        }
 public virtual HistoryFileManager.HistoryFileInfo GetHistoryFileInfo(Path historyFile
                                                                      , Path confFile, Path summaryFile, JobIndexInfo jobIndexInfo, bool isInDone)
 {
     return(new HistoryFileManager.HistoryFileInfo(this, historyFile, confFile, summaryFile
                                                   , jobIndexInfo, isInDone));
 }