Java Code Examples for org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager#NO_LABEL

The following examples show how to use org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager#NO_LABEL . 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: RMWebServices.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/scheduler")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public SchedulerTypeInfo getSchedulerInfo() {
  init();
  ResourceScheduler rs = rm.getResourceScheduler();
  SchedulerInfo sinfo;
  if (rs instanceof CapacityScheduler) {
    CapacityScheduler cs = (CapacityScheduler) rs;
    CSQueue root = cs.getRootQueue();
    sinfo =
        new CapacitySchedulerInfo(root, cs, new NodeLabel(
            RMNodeLabelsManager.NO_LABEL));
  } else if (rs instanceof FairScheduler) {
    FairScheduler fs = (FairScheduler) rs;
    sinfo = new FairSchedulerInfo(fs);
  } else if (rs instanceof FifoScheduler) {
    sinfo = new FifoSchedulerInfo(this.rm);
  } else {
    throw new NotFoundException("Unknown scheduler configured");
  }
  return new SchedulerTypeInfo(sinfo);
}
 
Example 2
Source File: SchedulerUtils.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private static void normalizeNodeLabelExpressionInRequest(
    ResourceRequest resReq, QueueInfo queueInfo) {

  String labelExp = resReq.getNodeLabelExpression();

  // if queue has default label expression, and RR doesn't have, use the
  // default label expression of queue
  if (labelExp == null && queueInfo != null && ResourceRequest.ANY
      .equals(resReq.getResourceName())) {
    labelExp = queueInfo.getDefaultNodeLabelExpression();
  }

  // If labelExp still equals to null, set it to be NO_LABEL
  if (labelExp == null) {
    labelExp = RMNodeLabelsManager.NO_LABEL;
  }
  resReq.setNodeLabelExpression(labelExp);
}
 
Example 3
Source File: SchedulerUtils.java    From big-c with Apache License 2.0 6 votes vote down vote up
private static void normalizeNodeLabelExpressionInRequest(
    ResourceRequest resReq, QueueInfo queueInfo) {

  String labelExp = resReq.getNodeLabelExpression();

  // if queue has default label expression, and RR doesn't have, use the
  // default label expression of queue
  if (labelExp == null && queueInfo != null && ResourceRequest.ANY
      .equals(resReq.getResourceName())) {
    labelExp = queueInfo.getDefaultNodeLabelExpression();
  }

  // If labelExp still equals to null, set it to be NO_LABEL
  if (labelExp == null) {
    labelExp = RMNodeLabelsManager.NO_LABEL;
  }
  resReq.setNodeLabelExpression(labelExp);
}
 
Example 4
Source File: SchedulerNode.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Get partition of which the node belongs to, if node-labels of this node is
 * empty or null, it belongs to NO_LABEL partition. And since we only support
 * one partition for each node (YARN-2694), first label will be its partition.
 */
public String getPartition() {
  if (this.labels == null || this.labels.isEmpty()) {
    return RMNodeLabelsManager.NO_LABEL; 
  } else {
    return this.labels.iterator().next();
  }
}
 
Example 5
Source File: AbstractCSQueue.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void incPendingResource(String nodeLabel, Resource resourceToInc) {
  if (nodeLabel == null) {
    nodeLabel = RMNodeLabelsManager.NO_LABEL;
  }
  // ResourceUsage has its own lock, no addition lock needs here.
  queueUsage.incPending(nodeLabel, resourceToInc);
  if (null != parent) {
    parent.incPendingResource(nodeLabel, resourceToInc);
  }
}
 
Example 6
Source File: AbstractCSQueue.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void decPendingResource(String nodeLabel, Resource resourceToDec) {
  if (nodeLabel == null) {
    nodeLabel = RMNodeLabelsManager.NO_LABEL;
  }
  // ResourceUsage has its own lock, no addition lock needs here.
  queueUsage.decPending(nodeLabel, resourceToDec);
  if (null != parent) {
    parent.decPendingResource(nodeLabel, resourceToDec);
  }
}
 
Example 7
Source File: LeafQueue.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private boolean checkResourceRequestMatchingNodeLabel(ResourceRequest offswitchResourceRequest,
    FiCaSchedulerNode node) {
  String askedNodeLabel = offswitchResourceRequest.getNodeLabelExpression();
  if (null == askedNodeLabel) {
    askedNodeLabel = RMNodeLabelsManager.NO_LABEL;
  }
  return askedNodeLabel.equals(node.getPartition());
}