Package org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt

Examples of org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl$AMContainerAllocatedTransition


    RMAppImpl app = spy(new RMAppImpl(applicationId3, rmContext, config, null,
        null, queueName, asContext, yarnScheduler, null,
        System.currentTimeMillis(), "YARN", null));
    ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
        ApplicationId.newInstance(123456, 1), 1);
    RMAppAttemptImpl rmAppAttemptImpl = spy(new RMAppAttemptImpl(attemptId,
        rmContext, yarnScheduler, null, asContext, config, false));
    Container container = Container.newInstance(
        ContainerId.newInstance(attemptId, 1), null, "", null, null, null);
    RMContainerImpl containerimpl = spy(new RMContainerImpl(container,
        attemptId, null, "", rmContext));
    Map<ApplicationAttemptId, RMAppAttempt> attempts =
      new HashMap<ApplicationAttemptId, RMAppAttempt>();
    attempts.put(attemptId, rmAppAttemptImpl);
    when(app.getCurrentAppAttempt()).thenReturn(rmAppAttemptImpl);
    when(app.getAppAttempts()).thenReturn(attempts);
    when(rmAppAttemptImpl.getMasterContainer()).thenReturn(container);
    ResourceScheduler rs = mock(ResourceScheduler.class);
    when(rmContext.getScheduler()).thenReturn(rs);
    when(rmContext.getScheduler().getRMContainer(any(ContainerId.class)))
        .thenReturn(containerimpl);
    SchedulerAppReport sAppReport = mock(SchedulerAppReport.class);
View Full Code Here


        ContainerState.COMPLETE, "Dummy Completed", 0);
    rm.getResourceTrackerService().handleContainerStatus(status);
    verify(handler, never()).handle((Event) any());

    // Case 1.2: Master container is null
    RMAppAttemptImpl currentAttempt =
        (RMAppAttemptImpl) app.getCurrentAppAttempt();
    currentAttempt.setMasterContainer(null);
    status = ContainerStatus.newInstance(
        ContainerId.newInstance(currentAttempt.getAppAttemptId(), 0),
        ContainerState.COMPLETE, "Dummy Completed", 0);
    rm.getResourceTrackerService().handleContainerStatus(status);
    verify(handler, never()).handle((Event)any());

    // Case 2: Managed AM
    app = rm.submitApp(1024);

    // Case 2.1: AppAttemptId is null
    status = ContainerStatus.newInstance(
        ContainerId.newInstance(ApplicationAttemptId.newInstance(
            app.getApplicationId(), 2), 1),
        ContainerState.COMPLETE, "Dummy Completed", 0);
    try {
      rm.getResourceTrackerService().handleContainerStatus(status);
    } catch (Exception e) {
      // expected - ignore
    }
    verify(handler, never()).handle((Event)any());

    // Case 2.2: Master container is null
    currentAttempt =
        (RMAppAttemptImpl) app.getCurrentAppAttempt();
    currentAttempt.setMasterContainer(null);
    status = ContainerStatus.newInstance(
        ContainerId.newInstance(currentAttempt.getAppAttemptId(), 0),
        ContainerState.COMPLETE, "Dummy Completed", 0);
    try {
      rm.getResourceTrackerService().handleContainerStatus(status);
    } catch (Exception e) {
      // expected - ignore
View Full Code Here

    ApplicationAttemptId appAttemptId = Records
        .newRecord(ApplicationAttemptId.class);
    appAttemptId.setApplicationId(applicationId);
    appAttemptId.setAttemptId(attempts.size() + 1);

    RMAppAttempt attempt = new RMAppAttemptImpl(appAttemptId,
        clientTokenStr, rmContext, scheduler, masterService,
        submissionContext, YarnConfiguration.getProxyHostAndPort(conf));
    attempts.put(appAttemptId, attempt);
    currentAttempt = attempt;
    handler.handle(
View Full Code Here

    ApplicationAttemptId appAttemptId = Records
        .newRecord(ApplicationAttemptId.class);
    appAttemptId.setApplicationId(applicationId);
    appAttemptId.setAttemptId(attempts.size() + 1);

    RMAppAttempt attempt = new RMAppAttemptImpl(appAttemptId,
        rmContext, scheduler, masterService, submissionContext, conf);
    attempts.put(appAttemptId, attempt);
    currentAttempt = attempt;
    handler.handle(
        new RMAppAttemptEvent(appAttemptId, RMAppAttemptEventType.START));
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl$AMContainerAllocatedTransition

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.