Package org.apache.hadoop.yarn.server.resourcemanager.resourcetracker

Examples of org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.InlineDispatcher


    }
  }

  @Before
  public void setUp() throws Exception {
    InlineDispatcher rmDispatcher = new InlineDispatcher();
   
    rmContext =
        new RMContextImpl(new MemStore(), rmDispatcher, null, null,
            mock(DelegationTokenRenewer.class), null, null, null);
    scheduler = mock(YarnScheduler.class);
    doAnswer(
        new Answer<Void>() {

          @Override
          public Void answer(InvocationOnMock invocation) throws Throwable {
            final SchedulerEvent event = (SchedulerEvent)(invocation.getArguments()[0]);
            eventType = event.getType();
            if (eventType == SchedulerEventType.NODE_UPDATE) {
              completedContainers =
                  ((NodeUpdateSchedulerEvent)event).getCompletedContainers();
            } else {
              completedContainers = null;
            }
            return null;
          }
        }
        ).when(scheduler).handle(any(SchedulerEvent.class));
   
    rmDispatcher.register(SchedulerEventType.class,
        new TestSchedulerEventDispatcher());
   
    NodeId nodeId = BuilderUtils.newNodeId("localhost", 0);
    node = new RMNodeImpl(nodeId, rmContext, null, 0, 0, null, null);
View Full Code Here


  @Before
  public void setUp() throws Exception {
    AsyncDispatcher rmDispatcher = new AsyncDispatcher();
    Configuration conf = new Configuration();
    rmDispatcher = new InlineDispatcher();

    ContainerAllocationExpirer containerAllocationExpirer =
        mock(ContainerAllocationExpirer.class);
    AMLivelinessMonitor amLivelinessMonitor = mock(AMLivelinessMonitor.class);
    this.rmContext =
View Full Code Here

 
  private static int appId = 1;

  @Before
  public void setUp() throws Exception {
    InlineDispatcher rmDispatcher = new InlineDispatcher();
 
    ContainerAllocationExpirer containerAllocationExpirer =
        mock(ContainerAllocationExpirer.class);
    AMLivelinessMonitor amLivelinessMonitor = mock(AMLivelinessMonitor.class);
    Configuration conf = new Configuration();
    rmContext =
        new RMContextImpl(new MemStore(), rmDispatcher,
          containerAllocationExpirer, amLivelinessMonitor, null,
          new ApplicationTokenSecretManager(conf),
          new RMContainerTokenSecretManager(conf),
          new ClientToAMSecretManager());
   
    scheduler = mock(YarnScheduler.class);
    masterService = mock(ApplicationMasterService.class);
    applicationMasterLauncher = mock(ApplicationMasterLauncher.class);
   
    rmDispatcher.register(RMAppAttemptEventType.class,
        new TestApplicationAttemptEventDispatcher());
 
    rmDispatcher.register(RMAppEventType.class,
        new TestApplicationEventDispatcher());
   
    rmDispatcher.register(SchedulerEventType.class,
        new TestSchedulerEventDispatcher());
   
    rmDispatcher.register(AMLauncherEventType.class,
        new TestAMLauncherEventDispatcher());

    rmDispatcher.init(conf);
    rmDispatcher.start();
   

    ApplicationId applicationId = MockApps.newAppID(appId++);
    ApplicationAttemptId applicationAttemptId =
        MockApps.newAppAttemptID(applicationId, 0);
View Full Code Here

  @Test
  public void testAbortJobCalledAfterKillingTasks() throws IOException {
    Configuration conf = new Configuration();
    conf.set(MRJobConfig.MR_AM_STAGING_DIR, stagingDir);
    conf.set(MRJobConfig.MR_AM_COMMITTER_CANCEL_TIMEOUT_MS, "1000");
    InlineDispatcher dispatcher = new InlineDispatcher();
    dispatcher.init(conf);
    dispatcher.start();
    OutputCommitter committer = Mockito.mock(OutputCommitter.class);
    CommitterEventHandler commitHandler =
        createCommitterEventHandler(dispatcher, committer);
    commitHandler.init(conf);
    commitHandler.start();
    JobImpl job = createRunningStubbedJob(conf, dispatcher, 2);

    //Fail one task. This should land the JobImpl in the FAIL_WAIT state
    job.handle(new JobTaskEvent(
      MRBuilderUtils.newTaskId(job.getID(), 1, TaskType.MAP),
      TaskState.FAILED));
    //Verify abort job hasn't been called
    Mockito.verify(committer, Mockito.never())
      .abortJob((JobContext) Mockito.any(), (State) Mockito.any());
    assertJobState(job, JobStateInternal.FAIL_WAIT);

    //Verify abortJob is called once and the job failed
    Mockito.verify(committer, Mockito.timeout(2000).times(1))
      .abortJob((JobContext) Mockito.any(), (State) Mockito.any());
    assertJobState(job, JobStateInternal.FAILED);

    dispatcher.stop();
  }
View Full Code Here

  }
 
  @Before
  @SuppressWarnings("unchecked")
  public void setup() {
     dispatcher = new InlineDispatcher();
   
    ++startCount;
   
    conf = new JobConf();
    taskAttemptListener = mock(TaskAttemptListener.class);
View Full Code Here

    JobID jobID = JobID.forName("job_1234567890000_0001");
    JobId jobId = TypeConverter.toYarn(jobID);
    OutputCommitter committer = mock(OutputCommitter.class);
    doThrow(new IOException("forcefail"))
      .when(committer).setupJob(any(JobContext.class));
    InlineDispatcher dispatcher = new InlineDispatcher();
    JobImpl job = new StubbedJob(jobId, Records
        .newRecord(ApplicationAttemptId.class), conf,
        dispatcher.getEventHandler(), committer, true, null);

    dispatcher.register(JobEventType.class, job);
    job.handle(new JobEvent(jobId, JobEventType.JOB_INIT));
    Assert.assertEquals(JobState.FAILED, job.getState());

    job.handle(new JobEvent(jobId, JobEventType.JOB_TASK_COMPLETED));
    Assert.assertEquals(JobState.FAILED, job.getState());
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.InlineDispatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.