Java Code Examples for org.apache.hadoop.yarn.api.records.NodeReport#newInstance()

The following examples show how to use org.apache.hadoop.yarn.api.records.NodeReport#newInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestYarnCLI.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private List<NodeReport> getNodeReports(int noOfNodes, NodeState state,
    boolean emptyNodeLabel) {
  List<NodeReport> nodeReports = new ArrayList<NodeReport>();

  for (int i = 0; i < noOfNodes; i++) {
    Set<String> nodeLabels = null;
    if (!emptyNodeLabel) {
      // node labels is not ordered, but when we output it, it should be
      // ordered
      nodeLabels = ImmutableSet.of("c", "b", "a", "x", "z", "y");
    }
    NodeReport nodeReport = NodeReport.newInstance(NodeId
      .newInstance("host" + i, 0), state, "host" + 1 + ":8888",
        "rack1", Records.newRecord(Resource.class), Records
            .newRecord(Resource.class), 0, "", 0, nodeLabels);
    nodeReports.add(nodeReport);
  }
  return nodeReports;
}
 
Example 2
Source File: TestYarnCLI.java    From big-c with Apache License 2.0 6 votes vote down vote up
private List<NodeReport> getNodeReports(int noOfNodes, NodeState state,
    boolean emptyNodeLabel) {
  List<NodeReport> nodeReports = new ArrayList<NodeReport>();

  for (int i = 0; i < noOfNodes; i++) {
    Set<String> nodeLabels = null;
    if (!emptyNodeLabel) {
      // node labels is not ordered, but when we output it, it should be
      // ordered
      nodeLabels = ImmutableSet.of("c", "b", "a", "x", "z", "y");
    }
    NodeReport nodeReport = NodeReport.newInstance(NodeId
      .newInstance("host" + i, 0), state, "host" + 1 + ":8888",
        "rack1", Records.newRecord(Resource.class), Records
            .newRecord(Resource.class), 0, "", 0, nodeLabels);
    nodeReports.add(nodeReport);
  }
  return nodeReports;
}
 
Example 3
Source File: ProtocolHATestBase.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public List<NodeReport> createFakeNodeReports() {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  NodeReport report =
      NodeReport.newInstance(nodeId, NodeState.RUNNING, "localhost",
          "rack1", null, null, 4, null, 1000l, null);
  List<NodeReport> reports = new ArrayList<NodeReport>();
  reports.add(report);
  return reports;
}
 
Example 4
Source File: ProtocolHATestBase.java    From big-c with Apache License 2.0 5 votes vote down vote up
public List<NodeReport> createFakeNodeReports() {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  NodeReport report =
      NodeReport.newInstance(nodeId, NodeState.RUNNING, "localhost",
          "rack1", null, null, 4, null, 1000l, null);
  List<NodeReport> reports = new ArrayList<NodeReport>();
  reports.add(report);
  return reports;
}
 
Example 5
Source File: TestAMNodeMap.java    From incubator-tez with Apache License 2.0 4 votes vote down vote up
private static NodeReport generateNodeReport(NodeId nodeId, NodeState nodeState) {
  NodeReport nodeReport = NodeReport.newInstance(nodeId, nodeState, nodeId.getHost() + ":3433",
      "/default-rack", Resource.newInstance(0, 0), Resource.newInstance(10240, 12), 10,
      nodeState.toString(), System.currentTimeMillis());
  return nodeReport;
}