示例#1
0
        /// <summary>simple test TaskUpdatedEvent and TaskUpdated</summary>
        /// <exception cref="System.Exception"/>
        public virtual void TestTaskUpdated()
        {
            JobID            jid  = new JobID("001", 1);
            TaskID           tid  = new TaskID(jid, TaskType.Reduce, 2);
            TaskUpdatedEvent test = new TaskUpdatedEvent(tid, 1234L);

            NUnit.Framework.Assert.AreEqual(test.GetTaskId().ToString(), tid.ToString());
            NUnit.Framework.Assert.AreEqual(test.GetFinishTime(), 1234L);
        }
示例#2
0
        /// <summary>Get the next event from the stream</summary>
        /// <returns>the next event</returns>
        /// <exception cref="System.IO.IOException"/>
        public virtual HistoryEvent GetNextEvent()
        {
            Event wrapper;

            try
            {
                wrapper = (Event)reader.Read(null, decoder);
            }
            catch (EOFException)
            {
                // at EOF
                return(null);
            }
            HistoryEvent result;

            switch (wrapper.type)
            {
            case EventType.JobSubmitted:
            {
                result = new JobSubmittedEvent();
                break;
            }

            case EventType.JobInited:
            {
                result = new JobInitedEvent();
                break;
            }

            case EventType.JobFinished:
            {
                result = new JobFinishedEvent();
                break;
            }

            case EventType.JobPriorityChanged:
            {
                result = new JobPriorityChangeEvent();
                break;
            }

            case EventType.JobQueueChanged:
            {
                result = new JobQueueChangeEvent();
                break;
            }

            case EventType.JobStatusChanged:
            {
                result = new JobStatusChangedEvent();
                break;
            }

            case EventType.JobFailed:
            {
                result = new JobUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.JobKilled:
            {
                result = new JobUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.JobError:
            {
                result = new JobUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.JobInfoChanged:
            {
                result = new JobInfoChangeEvent();
                break;
            }

            case EventType.TaskStarted:
            {
                result = new TaskStartedEvent();
                break;
            }

            case EventType.TaskFinished:
            {
                result = new TaskFinishedEvent();
                break;
            }

            case EventType.TaskFailed:
            {
                result = new TaskFailedEvent();
                break;
            }

            case EventType.TaskUpdated:
            {
                result = new TaskUpdatedEvent();
                break;
            }

            case EventType.MapAttemptStarted:
            {
                result = new TaskAttemptStartedEvent();
                break;
            }

            case EventType.MapAttemptFinished:
            {
                result = new MapAttemptFinishedEvent();
                break;
            }

            case EventType.MapAttemptFailed:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.MapAttemptKilled:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.ReduceAttemptStarted:
            {
                result = new TaskAttemptStartedEvent();
                break;
            }

            case EventType.ReduceAttemptFinished:
            {
                result = new ReduceAttemptFinishedEvent();
                break;
            }

            case EventType.ReduceAttemptFailed:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.ReduceAttemptKilled:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.SetupAttemptStarted:
            {
                result = new TaskAttemptStartedEvent();
                break;
            }

            case EventType.SetupAttemptFinished:
            {
                result = new TaskAttemptFinishedEvent();
                break;
            }

            case EventType.SetupAttemptFailed:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.SetupAttemptKilled:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.CleanupAttemptStarted:
            {
                result = new TaskAttemptStartedEvent();
                break;
            }

            case EventType.CleanupAttemptFinished:
            {
                result = new TaskAttemptFinishedEvent();
                break;
            }

            case EventType.CleanupAttemptFailed:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.CleanupAttemptKilled:
            {
                result = new TaskAttemptUnsuccessfulCompletionEvent();
                break;
            }

            case EventType.AmStarted:
            {
                result = new AMStartedEvent();
                break;
            }

            default:
            {
                throw new RuntimeException("unexpected event type: " + wrapper.type);
            }
            }
            result.SetDatum(wrapper.@event);
            return(result);
        }
示例#3
0
 private void HandleTaskUpdatedEvent(TaskUpdatedEvent @event)
 {
     JobHistoryParser.TaskInfo taskInfo = info.tasksMap[@event.GetTaskId()];
     taskInfo.finishTime = @event.GetFinishTime();
 }