Package org.apache.hadoop.yarn.api.records

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


    when(container.getPriority()).thenReturn(priority);
    return container;
  }

  public static ContainerId getMockContainerId(ApplicationAttemptId applicationAttemptId, int id) {
    ContainerId containerId = mock(ContainerId.class);
    doReturn(applicationAttemptId).when(containerId).getApplicationAttemptId();
    doReturn(id).when(containerId).getId();
    doReturn(Integer.toString(id)).when(containerId).toString();
    return containerId;
  }
View Full Code Here


  @Override
  protected void onContainerCompleted(ContainerStatus status) {
    super.onContainerCompleted(status);

    // find assigned container for step execution
    ContainerId containerId = status.getContainerId();
    StepExecution stepExecution = containerToStepMap.get(containerId);

    if (stepExecution != null) {
      for (Entry<StepExecution, Set<StepExecution>> entry : masterExecutions.entrySet()) {
        Set<StepExecution> set = entry.getValue();
View Full Code Here

  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
    // failed free running
    // allocated running completed failed
View Full Code Here

  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);

    // container 1
    // failed free running
    // allocated running completed failed
View Full Code Here

  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);
    ContainerId containerId3 = getMockContainerId(applicationAttemptId, 3);
    //Container container3 = getMockContainer(containerId3, null, null, null, ContainerState.NEW);

    // container 1
    // failed free running
    // allocated running completed failed
View Full Code Here

  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);

    monitor.onContainerStatus(Arrays.asList(getMockContainerStatus(containerId1, ContainerState.COMPLETE, -100)));
View Full Code Here

  @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);

    monitor.onContainerStatus(Arrays.asList(getMockContainerStatus(containerId1, ContainerState.COMPLETE, -101)));
View Full Code Here

  @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);

    monitor.onContainerStatus(Arrays.asList(getMockContainerStatus(containerId1, ContainerState.COMPLETE, -1000)));
View Full Code Here

   * @param applicationAttemptId the application attempt id
   * @param id the container id
   * @return mocked {@link ContainerId}
   */
  public static ContainerId getMockContainerId(ApplicationAttemptId applicationAttemptId, int id) {
    ContainerId containerId = mock(ContainerId.class);
    doReturn(applicationAttemptId).when(containerId).getApplicationAttemptId();
    doReturn(id).when(containerId).getId();
    doReturn(Integer.toString(id)).when(containerId).toString();
    return containerId;
  }
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  public TaskAttemptStateInternal recover(TaskAttemptInfo taInfo,
      OutputCommitter committer, boolean recoverOutput) {
    ContainerId containerId = taInfo.getContainerId();
    NodeId containerNodeId = ConverterUtils.toNodeId(taInfo.getHostname() + ":"
        + taInfo.getPort());
    String nodeHttpAddress = StringInterner.weakIntern(taInfo.getHostname() + ":"
        + taInfo.getHttpPort());
    // Resource/Priority/Tokens are only needed while launching the container on
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.api.records.ContainerId

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.