コード例 #1
0
        public virtual void TestJobHistoryFileNameBackwardsCompatible()
        {
            JobID  oldJobId       = JobID.ForName(JobId);
            JobId  jobId          = TypeConverter.ToYarn(oldJobId);
            long   submitTime     = long.Parse(SubmitTime);
            long   finishTime     = long.Parse(FinishTime);
            int    numMaps        = System.Convert.ToInt32(NumMaps);
            int    numReduces     = System.Convert.ToInt32(NumReduces);
            string jobHistoryFile = string.Format(OldJobHistoryFileFormatter, JobId, SubmitTime
                                                  , UserName, JobName, FinishTime, NumMaps, NumReduces, JobStatus);
            JobIndexInfo info = FileNameIndexUtils.GetIndexInfo(jobHistoryFile);

            NUnit.Framework.Assert.AreEqual("Job id incorrect after decoding old history file"
                                            , jobId, info.GetJobId());
            NUnit.Framework.Assert.AreEqual("Submit time incorrect after decoding old history file"
                                            , submitTime, info.GetSubmitTime());
            NUnit.Framework.Assert.AreEqual("User incorrect after decoding old history file",
                                            UserName, info.GetUser());
            NUnit.Framework.Assert.AreEqual("Job name incorrect after decoding old history file"
                                            , JobName, info.GetJobName());
            NUnit.Framework.Assert.AreEqual("Finish time incorrect after decoding old history file"
                                            , finishTime, info.GetFinishTime());
            NUnit.Framework.Assert.AreEqual("Num maps incorrect after decoding old history file"
                                            , numMaps, info.GetNumMaps());
            NUnit.Framework.Assert.AreEqual("Num reduces incorrect after decoding old history file"
                                            , numReduces, info.GetNumReduces());
            NUnit.Framework.Assert.AreEqual("Job status incorrect after decoding old history file"
                                            , JobStatus, info.GetJobStatus());
            NUnit.Framework.Assert.IsNull("Queue name incorrect after decoding old history file"
                                          , info.GetQueueName());
        }
コード例 #2
0
        /// <summary>Returns the jobId from a job history file name.</summary>
        /// <param name="pathString">the path string.</param>
        /// <returns>the JobId</returns>
        /// <exception cref="System.IO.IOException">if the filename format is invalid.</exception>
        public static JobID GetJobIDFromHistoryFilePath(string pathString)
        {
            string[]     parts        = pathString.Split(Path.Separator);
            string       fileNamePart = parts[parts.Length - 1];
            JobIndexInfo jobIndexInfo = FileNameIndexUtils.GetIndexInfo(fileNamePart);

            return(TypeConverter.FromYarn(jobIndexInfo.GetJobId()));
        }
コード例 #3
0
        public virtual void TestJobStartTimeBackwardsCompatible()
        {
            string jobHistoryFile = string.Format(OldFormatBeforeAddStartTime, JobId, SubmitTime
                                                  , UserName, JobNameWithDelimiterEscape, FinishTime, NumMaps, NumReduces, JobStatus
                                                  , QueueName);
            JobIndexInfo info = FileNameIndexUtils.GetIndexInfo(jobHistoryFile);

            NUnit.Framework.Assert.AreEqual(info.GetJobStartTime(), info.GetSubmitTime());
        }
コード例 #4
0
        public virtual void TestQueueNamePercentDecoding()
        {
            string jobHistoryFile = string.Format(JobHistoryFileFormatter, JobId, SubmitTime,
                                                  UserName, JobName, FinishTime, NumMaps, NumReduces, JobStatus, QueueNameWithDelimiterEscape
                                                  , JobStartTime);
            JobIndexInfo info = FileNameIndexUtils.GetIndexInfo(jobHistoryFile);

            NUnit.Framework.Assert.AreEqual("Queue name doesn't match", QueueNameWithDelimiter
                                            , info.GetQueueName());
        }
コード例 #5
0
        public virtual void TestQueueNamePercentEncoding()
        {
            JobIndexInfo info     = new JobIndexInfo();
            JobID        oldJobId = JobID.ForName(JobId);
            JobId        jobId    = TypeConverter.ToYarn(oldJobId);

            info.SetJobId(jobId);
            info.SetSubmitTime(long.Parse(SubmitTime));
            info.SetUser(UserName);
            info.SetJobName(JobName);
            info.SetFinishTime(long.Parse(FinishTime));
            info.SetNumMaps(System.Convert.ToInt32(NumMaps));
            info.SetNumReduces(System.Convert.ToInt32(NumReduces));
            info.SetJobStatus(JobStatus);
            info.SetQueueName(QueueNameWithDelimiter);
            info.SetJobStartTime(long.Parse(JobStartTime));
            string jobHistoryFile = FileNameIndexUtils.GetDoneFileName(info);

            NUnit.Framework.Assert.IsTrue("Queue name not encoded correctly into job history file"
                                          , jobHistoryFile.Contains(QueueNameWithDelimiterEscape));
        }
コード例 #6
0
        public virtual void TestEncodingDecodingEquivalence()
        {
            JobIndexInfo info     = new JobIndexInfo();
            JobID        oldJobId = JobID.ForName(JobId);
            JobId        jobId    = TypeConverter.ToYarn(oldJobId);

            info.SetJobId(jobId);
            info.SetSubmitTime(long.Parse(SubmitTime));
            info.SetUser(UserName);
            info.SetJobName(JobName);
            info.SetFinishTime(long.Parse(FinishTime));
            info.SetNumMaps(System.Convert.ToInt32(NumMaps));
            info.SetNumReduces(System.Convert.ToInt32(NumReduces));
            info.SetJobStatus(JobStatus);
            info.SetQueueName(QueueName);
            info.SetJobStartTime(long.Parse(JobStartTime));
            string       jobHistoryFile = FileNameIndexUtils.GetDoneFileName(info);
            JobIndexInfo parsedInfo     = FileNameIndexUtils.GetIndexInfo(jobHistoryFile);

            NUnit.Framework.Assert.AreEqual("Job id different after encoding and decoding", info
                                            .GetJobId(), parsedInfo.GetJobId());
            NUnit.Framework.Assert.AreEqual("Submit time different after encoding and decoding"
                                            , info.GetSubmitTime(), parsedInfo.GetSubmitTime());
            NUnit.Framework.Assert.AreEqual("User different after encoding and decoding", info
                                            .GetUser(), parsedInfo.GetUser());
            NUnit.Framework.Assert.AreEqual("Job name different after encoding and decoding",
                                            info.GetJobName(), parsedInfo.GetJobName());
            NUnit.Framework.Assert.AreEqual("Finish time different after encoding and decoding"
                                            , info.GetFinishTime(), parsedInfo.GetFinishTime());
            NUnit.Framework.Assert.AreEqual("Num maps different after encoding and decoding",
                                            info.GetNumMaps(), parsedInfo.GetNumMaps());
            NUnit.Framework.Assert.AreEqual("Num reduces different after encoding and decoding"
                                            , info.GetNumReduces(), parsedInfo.GetNumReduces());
            NUnit.Framework.Assert.AreEqual("Job status different after encoding and decoding"
                                            , info.GetJobStatus(), parsedInfo.GetJobStatus());
            NUnit.Framework.Assert.AreEqual("Queue name different after encoding and decoding"
                                            , info.GetQueueName(), parsedInfo.GetQueueName());
            NUnit.Framework.Assert.AreEqual("Job start time different after encoding and decoding"
                                            , info.GetJobStartTime(), parsedInfo.GetJobStartTime());
        }