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

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


    return applicationId;
  }

  public static Container getMockContainer(ContainerId containerId, NodeId nodeId, Resource resource,
      Priority priority) {
    Container container = mock(Container.class);
    when(container.getId()).thenReturn(containerId);
    when(container.getNodeId()).thenReturn(nodeId);
    when(container.getResource()).thenReturn(resource);
    when(container.getPriority()).thenReturn(priority);
    return container;
  }
View Full Code Here


    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
    monitor.onContainer(Arrays.asList(container1));
View Full Code Here

    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
    monitor.onContainer(Arrays.asList(container1));
View Full Code Here

    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
View Full Code Here

    // 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)));
    assertMonitorState(monitor, 0, 0, 0, 1);
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)));
    assertMonitorState(monitor, 0, 0, 0, 1);
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)));
    assertMonitorState(monitor, 0, 0, 0, 1);
View Full Code Here

   * @param state the {@link ContainerState}
   * @return mocked {@link Container}
   */
  public static Container getMockContainer(ContainerId containerId, NodeId nodeId, Resource resource,
      Priority priority) {
    Container container = mock(Container.class);
    when(container.getId()).thenReturn(containerId);
    when(container.getNodeId()).thenReturn(nodeId);
    when(container.getResource()).thenReturn(resource);
    when(container.getPriority()).thenReturn(priority);
    return container;
  }
View Full Code Here

    @Override
    public void transition(final TaskAttemptImpl taskAttempt,
        TaskAttemptEvent event) {
      final TaskAttemptContainerAssignedEvent cEvent =
        (TaskAttemptContainerAssignedEvent) event;
      Container container = cEvent.getContainer();
      taskAttempt.container = container;
      // this is a _real_ Task (classic Hadoop mapred flavor):
      taskAttempt.remoteTask = taskAttempt.createRemoteTask();
      taskAttempt.jvmID =
          new WrappedJvmID(taskAttempt.remoteTask.getTaskID().getJobID(),
View Full Code Here

    Assert.assertEquals(2 * GB, report_nm2.getAvailableResource().getMemory());

    Assert.assertEquals(6 * GB, report_nm1.getUsedResource().getMemory());
    Assert.assertEquals(2 * GB, report_nm2.getUsedResource().getMemory());

    Container c1 = allocated1.get(0);
    Assert.assertEquals(GB, c1.getResource().getMemory());
    ContainerStatus containerStatus = BuilderUtils.newContainerStatus(
        c1.getId(), ContainerState.COMPLETE, "", 0);
    nm1.containerStatus(containerStatus);
    int waitCount = 0;
    while (attempt1.getJustFinishedContainers().size() < 1
        && waitCount++ != 20) {
      LOG.info("Waiting for containers to be finished for app 1... Tried "
View Full Code Here

TOP

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

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.