/// <summary>test deprecated methods of TaskID</summary> /// <exception cref="System.IO.IOException"/> public virtual void TestDepricatedMethods() { JobID jid = new JobID(); TaskID test = new TaskID(jid, true, 1); NUnit.Framework.Assert.AreEqual(test.GetTaskType(), TaskType.Map); test = new TaskID(jid, false, 1); NUnit.Framework.Assert.AreEqual(test.GetTaskType(), TaskType.Reduce); test = new TaskID("001", 1, false, 1); NUnit.Framework.Assert.AreEqual(test.GetTaskType(), TaskType.Reduce); test = new TaskID("001", 1, true, 1); NUnit.Framework.Assert.AreEqual(test.GetTaskType(), TaskType.Map); ByteArrayOutputStream @out = new ByteArrayOutputStream(); test.Write(new DataOutputStream(@out)); TaskID ti = TaskID.Read(new DataInputStream(new ByteArrayInputStream(@out.ToByteArray ()))); NUnit.Framework.Assert.AreEqual(ti.ToString(), test.ToString()); NUnit.Framework.Assert.AreEqual("task_001_0001_m_000002", TaskID.GetTaskIDsPattern ("001", 1, true, 2)); NUnit.Framework.Assert.AreEqual("task_003_0001_m_000004", TaskID.GetTaskIDsPattern ("003", 1, TaskType.Map, 4)); NUnit.Framework.Assert.AreEqual("003_0001_m_000004", TaskID.GetTaskIDsPatternWOPrefix ("003", 1, TaskType.Map, 4).ToString()); }
internal static StringBuilder GetTaskAttemptIDsPatternWOPrefix(string jtIdentifier , int jobId, TaskType type, int taskId, int attemptId) { StringBuilder builder = new StringBuilder(); builder.Append(TaskID.GetTaskIDsPatternWOPrefix(jtIdentifier, jobId, type, taskId )).Append(Separator).Append(attemptId != null ? attemptId : "[0-9]*"); return(builder); }