コード例 #1
0
ファイル: TestTaskImpl.cs プロジェクト: orf53975/hadoop.net
        public virtual void TestFailureDuringTaskAttemptCommit()
        {
            mockTask = CreateMockTask(TaskType.Map);
            TaskId taskId = GetNewTaskID();

            ScheduleTaskAttempt(taskId);
            LaunchTaskAttempt(GetLastAttempt().GetAttemptId());
            UpdateLastAttemptState(TaskAttemptState.CommitPending);
            CommitTaskAttempt(GetLastAttempt().GetAttemptId());
            // During the task attempt commit there is an exception which causes
            // the attempt to fail
            UpdateLastAttemptState(TaskAttemptState.Failed);
            FailRunningTaskAttempt(GetLastAttempt().GetAttemptId());
            NUnit.Framework.Assert.AreEqual(2, taskAttempts.Count);
            UpdateLastAttemptState(TaskAttemptState.Succeeded);
            CommitTaskAttempt(GetLastAttempt().GetAttemptId());
            mockTask.Handle(new TaskTAttemptEvent(GetLastAttempt().GetAttemptId(), TaskEventType
                                                  .TAttemptSucceeded));
            NUnit.Framework.Assert.IsFalse("First attempt should not commit", mockTask.CanCommit
                                               (taskAttempts[0].GetAttemptId()));
            NUnit.Framework.Assert.IsTrue("Second attempt should commit", mockTask.CanCommit(
                                              GetLastAttempt().GetAttemptId()));
            AssertTaskSucceededState();
        }
コード例 #2
0
ファイル: TestTaskImpl.cs プロジェクト: orf53975/hadoop.net
        public virtual void TestKillDuringTaskAttemptCommit()
        {
            mockTask = CreateMockTask(TaskType.Reduce);
            TaskId taskId = GetNewTaskID();

            ScheduleTaskAttempt(taskId);
            LaunchTaskAttempt(GetLastAttempt().GetAttemptId());
            UpdateLastAttemptState(TaskAttemptState.CommitPending);
            CommitTaskAttempt(GetLastAttempt().GetAttemptId());
            TaskAttemptId commitAttempt = GetLastAttempt().GetAttemptId();

            UpdateLastAttemptState(TaskAttemptState.Killed);
            KillRunningTaskAttempt(commitAttempt);
            NUnit.Framework.Assert.IsFalse(mockTask.CanCommit(commitAttempt));
        }