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

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


    projection.setPriority(0);
    projection.setProjectionData(new ProjectionData(2));
    Integer count = TestUtils.readField("count", projection);
    assertThat(count, is(2));

    Priority priority = MockUtils.getMockPriority(0);

    ContainerId id1 = MockUtils.getMockContainerId(MockUtils.getMockApplicationAttemptId(0, 0), 1);
    Container container1 = MockUtils.getMockContainer(id1, null, null, priority);
    DefaultGridMember member1 = new DefaultGridMember(container1);
    projection.acceptMember(member1);
View Full Code Here


  }

  protected Container allocateContainer(Object appmaster, int id, String host) throws Exception {
    ContainerId containerId = MockUtils.getMockContainerId(MockUtils.getMockApplicationAttemptId(0, 0), 0);
    NodeId nodeId = MockUtils.getMockNodeId(host, 0);
    Priority priority = MockUtils.getMockPriority(0);
    Container container = MockUtils.getMockContainer(containerId, nodeId, null, priority);
    TestUtils.callMethod("onContainerAllocated", appmaster, new Object[]{container}, new Class<?>[]{Container.class});
    return container;
  }
View Full Code Here

    assertThat(satisfyState.getAllocateData().getRacks().size(), is(0));
    assertThat(satisfyState.getRemoveData().size(), is(0));

    ContainerId id1 = MockUtils.getMockContainerId(MockUtils.getMockApplicationAttemptId(0, 0), 1);
    NodeId nodeId1 = MockUtils.getMockNodeId("host1", 0);
    Priority priority = MockUtils.getMockPriority(0);
    Container container1 = MockUtils.getMockContainer(id1, nodeId1, null, priority);
    DefaultGridMember member1 = new DefaultGridMember(container1);
    boolean accepted = projection.acceptMember(member1);
    assertThat(accepted, is(true));
View Full Code Here

    assertThat(satisfyState.getAllocateData().getRacks().size(), is(0));
    assertThat(satisfyState.getRemoveData().size(), is(0));

    ContainerId id1 = MockUtils.getMockContainerId(MockUtils.getMockApplicationAttemptId(0, 0), 1);
    NodeId nodeId1 = MockUtils.getMockNodeId("host1", 0);
    Priority priority1 = MockUtils.getMockPriority(0);
    Container container1 = MockUtils.getMockContainer(id1, nodeId1, null, priority1);
    DefaultGridMember member1 = new DefaultGridMember(container1);
    assertThat(projection.acceptMember(member1), is(true));

    ContainerId id2 = MockUtils.getMockContainerId(MockUtils.getMockApplicationAttemptId(0, 0), 2);
    NodeId nodeId2 = MockUtils.getMockNodeId("host1", 0);
    Priority priority2 = MockUtils.getMockPriority(0);
    Container container2 = MockUtils.getMockContainer(id2, nodeId2, null, priority2);
    DefaultGridMember member2 = new DefaultGridMember(container2);
    assertThat(projection.acceptMember(member2), is(true));

    ContainerId id3 = MockUtils.getMockContainerId(MockUtils.getMockApplicationAttemptId(0, 0), 3);
    NodeId nodeId3 = MockUtils.getMockNodeId("host2", 0);
    Priority priority3 = MockUtils.getMockPriority(0);
    Container container3 = MockUtils.getMockContainer(id3, nodeId3, null, priority3);
    DefaultGridMember member3 = new DefaultGridMember(container3);
    assertThat(projection.acceptMember(member3), is(true));

    ContainerId id4 = MockUtils.getMockContainerId(MockUtils.getMockApplicationAttemptId(0, 0), 4);
    NodeId nodeId4 = MockUtils.getMockNodeId("host2", 0);
    Priority priority4 = MockUtils.getMockPriority(0);
    Container container4 = MockUtils.getMockContainer(id4, nodeId4, null, priority4);
    DefaultGridMember member4 = new DefaultGridMember(container4);
    assertThat(projection.acceptMember(member4), is(true));

    satisfyState = projection.getSatisfyState();
View Full Code Here

    doReturn(Integer.toString(id)).when(containerId).toString();
    return containerId;
  }

  public static Priority getMockPriority(int priority) {
    Priority pri = mock(Priority.class);
    when(pri.getPriority()).thenReturn(priority);
    return pri;
  }
View Full Code Here

  public Configuration getConfiguration() {
    return configuration;
  }

  protected boolean isSamePriority(GridMember member) {
    Priority pri = member.getContainer().getPriority();
    if (pri != null && getPriority() != null) {
      return pri.getPriority() == getPriority().intValue();
    }
    return false;
  }
View Full Code Here

        ResourceRequest request = Records.newRecord(ResourceRequest.class);
        request.setRelaxLocality(relaxLocality);
        request.setResourceName(hostName);
        request.setNumContainers(numContainers);
        Priority pri = Records.newRecord(Priority.class);
        pri.setPriority(allocationValues.priority);
        request.setPriority(pri);
        Resource capability = Records.newRecord(Resource.class);
        capability.setMemory(allocationValues.memory);
        ResourceCompat.setVirtualCores(capability, allocationValues.virtualcores);
        request.setCapability(capability);
View Full Code Here

    container.setApplicationACLs(acls);
    return container;
  }

  public static Priority newPriority(int p) {
    Priority priority = recordFactory.newRecordInstance(Priority.class);
    priority.setPriority(p);
    return priority;
  }
View Full Code Here

    // amContainer.setContainerId(containerId);   

    appContext.setAMContainerSpec(amContainer);

    // Set the priority for the application master
    Priority pri = Records.newRecord(Priority.class);
    // TODO - what is the range for priority? how to decide?
    pri.setPriority(amPriority);
    appContext.setPriority(pri);

    // Set the queue to which this application is to be submitted in the RM
    appContext.setQueue(amQueue);
View Full Code Here

    // set no. of containers needed
    request.setNumContainers(numContainers);

    // set the priority for the request
    Priority pri = Records.newRecord(Priority.class);
    // TODO - what is the range for priority? how to decide?
    pri.setPriority(requestPriority);
    request.setPriority(pri);

    // Set up resource type requirements
    // For now, only memory is supported so we set memory requirements
    Resource capability = Records.newRecord(Resource.class);
View Full Code Here

TOP

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

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.