Examples of ApplicationAttemptId


Examples of org.apache.hadoop.yarn.api.records.ApplicationAttemptId

  public static ApplicationAttemptId getMockApplicationAttemptId(int appId, int attemptId) {
    ApplicationId applicationId = mock(ApplicationId.class);
    when(applicationId.getClusterTimestamp()).thenReturn(0L);
    when(applicationId.getId()).thenReturn(appId);
    ApplicationAttemptId applicationAttemptId = mock(ApplicationAttemptId.class);
    when(applicationAttemptId.getApplicationId()).thenReturn(applicationId);
    when(applicationAttemptId.getAttemptId()).thenReturn(attemptId);
    return applicationAttemptId;
  }
View Full Code Here

Examples of org.apache.hadoop.yarn.api.records.ApplicationAttemptId

  @Test
  public void testSucceed() throws Exception {
    DefaultContainerMonitor monitor = new DefaultContainerMonitor();

    ApplicationAttemptId applicationAttemptId = getMockApplicationAttemptId(1, 1);

    ContainerId containerId1 = getMockContainerId(applicationAttemptId, 1);
    Container container1 = getMockContainer(containerId1, null, null, null);

    // container 1
View Full Code Here

Examples of org.apache.hadoop.yarn.api.records.ApplicationAttemptId

  @Test
  public void testTwoSucceed() throws Exception {
    DefaultContainerMonitor monitor = new DefaultContainerMonitor();

    ApplicationAttemptId applicationAttemptId = getMockApplicationAttemptId(1, 1);

    ContainerId containerId1 = getMockContainerId(applicationAttemptId, 1);
    Container container1 = getMockContainer(containerId1, null, null, null);
    ContainerId containerId2 = getMockContainerId(applicationAttemptId, 2);
    Container container2 = getMockContainer(containerId2, null, null, null);
View Full Code Here

Examples of org.apache.hadoop.yarn.api.records.ApplicationAttemptId

  @Test
  public void testFailedAndSucceedWithGarbage() throws Exception {
    DefaultContainerMonitor monitor = new DefaultContainerMonitor();

    ApplicationAttemptId applicationAttemptId = getMockApplicationAttemptId(1, 1);

    ContainerId containerId1 = getMockContainerId(applicationAttemptId, 1);
    Container container1 = getMockContainer(containerId1, null, null, null);
    ContainerId containerId2 = getMockContainerId(applicationAttemptId, 2);
    Container container2 = getMockContainer(containerId2, null, null, null);
View Full Code Here

Examples of org.apache.hadoop.yarn.api.records.ApplicationAttemptId

  @Test
  public void testFailedWithContainerLoss() throws Exception {
    // SHDP-385 case when nm is killed and eventually rm receives
    // Container released on a *lost* node" exit_status: -100
    DefaultContainerMonitor monitor = new DefaultContainerMonitor();
    ApplicationAttemptId applicationAttemptId = getMockApplicationAttemptId(1, 1);
    ContainerId containerId1 = getMockContainerId(applicationAttemptId, 1);
    Container container1 = getMockContainer(containerId1, null, null, null);
    monitor.onContainer(Arrays.asList(container1));
    assertMonitorState(monitor, 1, 0, 0, 0);

View Full Code Here

Examples of org.apache.hadoop.yarn.api.records.ApplicationAttemptId

  }

  @Test
  public void testFailedWithContainerDiskFailed() throws Exception {
    DefaultContainerMonitor monitor = new DefaultContainerMonitor();
    ApplicationAttemptId applicationAttemptId = getMockApplicationAttemptId(1, 1);
    ContainerId containerId1 = getMockContainerId(applicationAttemptId, 1);
    Container container1 = getMockContainer(containerId1, null, null, null);
    monitor.onContainer(Arrays.asList(container1));
    assertMonitorState(monitor, 1, 0, 0, 0);
View Full Code Here

Examples of org.apache.hadoop.yarn.api.records.ApplicationAttemptId

  }

  @Test
  public void testFailedWithContainerInvalid() throws Exception {
    DefaultContainerMonitor monitor = new DefaultContainerMonitor();
    ApplicationAttemptId applicationAttemptId = getMockApplicationAttemptId(1, 1);
    ContainerId containerId1 = getMockContainerId(applicationAttemptId, 1);
    Container container1 = getMockContainer(containerId1, null, null, null);
    monitor.onContainer(Arrays.asList(container1));
    assertMonitorState(monitor, 1, 0, 0, 0);
View Full Code Here

Examples of org.apache.hadoop.yarn.api.records.ApplicationAttemptId

   */
  public static ApplicationAttemptId getMockApplicationAttemptId(int appId, int attemptId) {
    ApplicationId applicationId = mock(ApplicationId.class);
    when(applicationId.getClusterTimestamp()).thenReturn(0L);
    when(applicationId.getId()).thenReturn(appId);
    ApplicationAttemptId applicationAttemptId = mock(ApplicationAttemptId.class);
    when(applicationAttemptId.getApplicationId()).thenReturn(applicationId);
    when(applicationAttemptId.getAttemptId()).thenReturn(attemptId);
    return applicationAttemptId;
  }
View Full Code Here

Examples of org.apache.hadoop.yarn.api.records.ApplicationAttemptId

    TestingJobEventHandler jeh = new TestingJobEventHandler();
    dispatcher.register(JobEventType.class, jeh);

    SystemClock clock = new SystemClock();
    AppContext appContext = mock(AppContext.class);
    ApplicationAttemptId attemptid =
      ConverterUtils.toApplicationAttemptId("appattempt_1234567890000_0001_0");
    when(appContext.getApplicationID()).thenReturn(attemptid.getApplicationId());
    when(appContext.getApplicationAttemptId()).thenReturn(attemptid);
    when(appContext.getEventHandler()).thenReturn(
        dispatcher.getEventHandler());
    when(appContext.getClock()).thenReturn(clock);
    OutputCommitter committer = mock(OutputCommitter.class);
View Full Code Here

Examples of org.apache.hadoop.yarn.api.records.ApplicationAttemptId

    CommitterEventHandler handler = new CommitterEventHandler(mockContext,
        mockCommitter, new TestingRMHeartbeatHandler());
    YarnConfiguration conf = new YarnConfiguration();
    conf.set(MRJobConfig.MR_AM_STAGING_DIR, stagingDir);
    JobContext mockJobContext = mock(JobContext.class);
    ApplicationAttemptId attemptid =
      ConverterUtils.toApplicationAttemptId("appattempt_1234567890000_0001_0");
    JobId jobId =  TypeConverter.toYarn(
        TypeConverter.fromYarn(attemptid.getApplicationId()));
   
    WaitForItHandler waitForItHandler = new WaitForItHandler();
   
    when(mockContext.getApplicationID()).thenReturn(attemptid.getApplicationId());
    when(mockContext.getApplicationAttemptId()).thenReturn(attemptid);
    when(mockContext.getEventHandler()).thenReturn(waitForItHandler);
    when(mockContext.getClock()).thenReturn(mockClock);
   
    handler.init(conf);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.