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()); }
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()); }
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()); }
private static string GetQueueName(JobIndexInfo indexInfo) { return(GetNonEmptyString(indexInfo.GetQueueName())); }