Exemplo n.º 1
0
 private void LoadAllTaskAttempts()
 {
     if (taskAttemptsLoaded.Get())
     {
         return;
     }
     taskAttemptsLock.Lock();
     try
     {
         if (taskAttemptsLoaded.Get())
         {
             return;
         }
         foreach (JobHistoryParser.TaskAttemptInfo attemptHistory in taskInfo.GetAllTaskAttempts
                      ().Values)
         {
             CompletedTaskAttempt attempt = new CompletedTaskAttempt(taskId, attemptHistory);
             Sharpen.Collections.AddAll(reportDiagnostics, attempt.GetDiagnostics());
             attempts[attempt.GetID()] = attempt;
             if (successfulAttempt == null && attemptHistory.GetTaskStatus() != null && attemptHistory
                 .GetTaskStatus().Equals(TaskState.Succeeded.ToString()))
             {
                 successfulAttempt = TypeConverter.ToYarn(attemptHistory.GetAttemptId());
             }
         }
         taskAttemptsLoaded.Set(true);
     }
     finally
     {
         taskAttemptsLock.Unlock();
     }
 }
Exemplo n.º 2
0
        /// <summary>test some methods of CompletedTaskAttempt</summary>
        public virtual void TestCompletedTaskAttempt()
        {
            JobHistoryParser.TaskAttemptInfo attemptInfo = Org.Mockito.Mockito.Mock <JobHistoryParser.TaskAttemptInfo
                                                                                     >();
            Org.Mockito.Mockito.When(attemptInfo.GetRackname()).ThenReturn("Rackname");
            Org.Mockito.Mockito.When(attemptInfo.GetShuffleFinishTime()).ThenReturn(11L);
            Org.Mockito.Mockito.When(attemptInfo.GetSortFinishTime()).ThenReturn(12L);
            Org.Mockito.Mockito.When(attemptInfo.GetShufflePort()).ThenReturn(10);
            JobID         jobId         = new JobID("12345", 0);
            TaskID        taskId        = new TaskID(jobId, TaskType.Reduce, 0);
            TaskAttemptID taskAttemptId = new TaskAttemptID(taskId, 0);

            Org.Mockito.Mockito.When(attemptInfo.GetAttemptId()).ThenReturn(taskAttemptId);
            CompletedTaskAttempt taskAttemt = new CompletedTaskAttempt(null, attemptInfo);

            NUnit.Framework.Assert.AreEqual("Rackname", taskAttemt.GetNodeRackName());
            NUnit.Framework.Assert.AreEqual(Phase.Cleanup, taskAttemt.GetPhase());
            NUnit.Framework.Assert.IsTrue(taskAttemt.IsFinished());
            NUnit.Framework.Assert.AreEqual(11L, taskAttemt.GetShuffleFinishTime());
            NUnit.Framework.Assert.AreEqual(12L, taskAttemt.GetSortFinishTime());
            NUnit.Framework.Assert.AreEqual(10, taskAttemt.GetShufflePort());
        }