public override string ToString() { StringBuilder builder = new StringBuilder(Task); JobId jobId = GetJobId(); builder.Append("_").Append(jobId.GetAppId().GetClusterTimestamp()); builder.Append("_").Append(JobId.jobIdFormat.Get().Format(jobId.GetAppId().GetId( ))); builder.Append("_"); builder.Append(GetTaskType() == TaskType.Map ? "m" : "r").Append("_"); builder.Append(taskIdFormat.Get().Format(GetId())); return(builder.ToString()); }
public virtual void TestJobId() { long ts1 = 1315890136000l; long ts2 = 1315890136001l; JobId j1 = CreateJobId(ts1, 2); JobId j2 = CreateJobId(ts1, 1); JobId j3 = CreateJobId(ts2, 1); JobId j4 = CreateJobId(ts1, 2); NUnit.Framework.Assert.IsTrue(j1.Equals(j4)); NUnit.Framework.Assert.IsFalse(j1.Equals(j2)); NUnit.Framework.Assert.IsFalse(j1.Equals(j3)); NUnit.Framework.Assert.IsTrue(j1.CompareTo(j4) == 0); NUnit.Framework.Assert.IsTrue(j1.CompareTo(j2) > 0); NUnit.Framework.Assert.IsTrue(j1.CompareTo(j3) < 0); NUnit.Framework.Assert.IsTrue(j1.GetHashCode() == j4.GetHashCode()); NUnit.Framework.Assert.IsFalse(j1.GetHashCode() == j2.GetHashCode()); NUnit.Framework.Assert.IsFalse(j1.GetHashCode() == j3.GetHashCode()); JobId j5 = CreateJobId(ts1, 231415); NUnit.Framework.Assert.AreEqual("job_" + ts1 + "_0002", j1.ToString()); NUnit.Framework.Assert.AreEqual("job_" + ts1 + "_231415", j5.ToString()); }
public abstract void SetJobId(JobId jobId);