public static TaskAttemptContext CreateDummyMapTaskAttemptContext(Configuration conf ) { TaskAttemptID tid = new TaskAttemptID("jt", 1, TaskType.Map, 0, 0); conf.Set(MRJobConfig.TaskAttemptId, tid.ToString()); return(new TaskAttemptContextImpl(conf, tid)); }
/// <summary>test a kill task</summary> /// <exception cref="System.Exception"/> private void TestKillTask(Configuration conf) { Job job = RunJobInBackGround(conf); CLI jc = CreateJobClient(); TaskID tid = new TaskID(job.GetJobID(), TaskType.Map, 0); TaskAttemptID taid = new TaskAttemptID(tid, 1); ByteArrayOutputStream @out = new ByteArrayOutputStream(); // bad parameters int exitCode = RunTool(conf, jc, new string[] { "-kill-task" }, @out); NUnit.Framework.Assert.AreEqual("Exit code", -1, exitCode); RunTool(conf, jc, new string[] { "-kill-task", taid.ToString() }, @out); string answer = Sharpen.Runtime.GetStringForBytes(@out.ToByteArray(), "UTF-8"); NUnit.Framework.Assert.IsTrue(answer.Contains("Killed task " + taid)); }