Exemplo n.º 1
0
 public EventFetcher(TaskAttemptID reduce, TaskUmbilicalProtocol umbilical, ShuffleScheduler
                     <K, V> scheduler, ExceptionReporter reporter, int maxEventsToFetch)
 {
     SetName("EventFetcher for fetching Map Completion Events");
     SetDaemon(true);
     this.reduce           = reduce;
     this.umbilical        = umbilical;
     this.scheduler        = scheduler;
     exceptionReporter     = reporter;
     this.maxEventsToFetch = maxEventsToFetch;
 }
Exemplo n.º 2
0
        public virtual void TestConsecutiveFetch()
        {
            int                   MaxEventsToFetch = 100;
            TaskAttemptID         tid       = new TaskAttemptID("12345", 1, TaskType.Reduce, 1, 1);
            TaskUmbilicalProtocol umbilical = Org.Mockito.Mockito.Mock <TaskUmbilicalProtocol>
                                                  ();

            Org.Mockito.Mockito.When(umbilical.GetMapCompletionEvents(Matchers.Any <JobID>(),
                                                                      Matchers.AnyInt(), Matchers.AnyInt(), Matchers.Any <TaskAttemptID>())).ThenReturn
                (GetMockedCompletionEventsUpdate(0, 0));
            Org.Mockito.Mockito.When(umbilical.GetMapCompletionEvents(Matchers.Any <JobID>(),
                                                                      Matchers.Eq(0), Matchers.Eq(MaxEventsToFetch), Matchers.Eq(tid))).ThenReturn(GetMockedCompletionEventsUpdate
                                                                                                                                                       (0, MaxEventsToFetch));
            Org.Mockito.Mockito.When(umbilical.GetMapCompletionEvents(Matchers.Any <JobID>(),
                                                                      Matchers.Eq(MaxEventsToFetch), Matchers.Eq(MaxEventsToFetch), Matchers.Eq(tid)))
            .ThenReturn(GetMockedCompletionEventsUpdate(MaxEventsToFetch, MaxEventsToFetch));
            Org.Mockito.Mockito.When(umbilical.GetMapCompletionEvents(Matchers.Any <JobID>(),
                                                                      Matchers.Eq(MaxEventsToFetch * 2), Matchers.Eq(MaxEventsToFetch), Matchers.Eq(tid
                                                                                                                                                    ))).ThenReturn(GetMockedCompletionEventsUpdate(MaxEventsToFetch * 2, 3));
            ShuffleScheduler <string, string> scheduler = Org.Mockito.Mockito.Mock <ShuffleScheduler
                                                                                    >();
            ExceptionReporter reporter = Org.Mockito.Mockito.Mock <ExceptionReporter>();

            TestEventFetcher.EventFetcherForTest <string, string> ef = new TestEventFetcher.EventFetcherForTest
                                                                       <string, string>(tid, umbilical, scheduler, reporter, MaxEventsToFetch);
            ef.GetMapCompletionEvents();
            Org.Mockito.Mockito.Verify(reporter, Org.Mockito.Mockito.Never()).ReportException
                (Matchers.Any <Exception>());
            InOrder inOrder = Org.Mockito.Mockito.InOrder(umbilical);

            inOrder.Verify(umbilical).GetMapCompletionEvents(Matchers.Any <JobID>(), Matchers.Eq
                                                                 (0), Matchers.Eq(MaxEventsToFetch), Matchers.Eq(tid));
            inOrder.Verify(umbilical).GetMapCompletionEvents(Matchers.Any <JobID>(), Matchers.Eq
                                                                 (MaxEventsToFetch), Matchers.Eq(MaxEventsToFetch), Matchers.Eq(tid));
            inOrder.Verify(umbilical).GetMapCompletionEvents(Matchers.Any <JobID>(), Matchers.Eq
                                                                 (MaxEventsToFetch * 2), Matchers.Eq(MaxEventsToFetch), Matchers.Eq(tid));
            Org.Mockito.Mockito.Verify(scheduler, Org.Mockito.Mockito.Times(MaxEventsToFetch
                                                                            * 2 + 3)).Resolve(Matchers.Any <TaskCompletionEvent>());
        }
Exemplo n.º 3
0
 public EventFetcherForTest(TaskAttemptID reduce, TaskUmbilicalProtocol umbilical,
                            ShuffleScheduler <K, V> scheduler, ExceptionReporter reporter, int maxEventsToFetch
                            )
     : base(reduce, umbilical, scheduler, reporter, maxEventsToFetch)
 {
 }