@Override public QueueMetrics getRootQueueMetrics() { return getRootQueue().getMetrics(); }
@Override public ResourceUsage getClusterResourceUsage() { return getRootQueue().getQueueResourceUsage(); }
@Override @Lock(Lock.NoLock.class) public List<QueueUserACLInfo> getQueueUserAclInfo() { UserGroupInformation user = null; try { user = UserGroupInformation.getCurrentUser(); } catch (IOException ioe) { // should never happen return new ArrayList<QueueUserACLInfo>(); } return getRootQueue().getQueueUserAclInfo(user); }
public boolean isSystemAppsLimitReached() { if (getRootQueue().getNumApplications() < conf .getMaximumSystemApplications()) { return false; } return true; }
/** * Process resource update on a node. */ private void updateNodeAndQueueResource(RMNode nm, ResourceOption resourceOption) { try { writeLock.lock(); updateNodeResource(nm, resourceOption); Resource clusterResource = getClusterResource(); getRootQueue().updateClusterResource(clusterResource, new ResourceLimits(clusterResource)); } finally { writeLock.unlock(); } }
public void updateQueueConfig(String queuesConfig) { ParentQueue root = mockQueueHierarchy(queuesConfig); when(cs.getRootQueue()).thenReturn(root); }
/** * Process node labels update. */ private void updateNodeLabelsAndQueueResource( NodeLabelsUpdateSchedulerEvent labelUpdateEvent) { try { writeLock.lock(); Set<String> updateLabels = new HashSet<String>(); for (Entry<NodeId, Set<String>> entry : labelUpdateEvent .getUpdatedNodeToLabels().entrySet()) { NodeId id = entry.getKey(); Set<String> labels = entry.getValue(); FiCaSchedulerNode node = nodeTracker.getNode(id); if (node != null) { // Update old partition to list. updateLabels.add(node.getPartition()); } updateLabelsOnNode(id, labels); updateLabels.addAll(labels); } refreshLabelToNodeCache(updateLabels); Resource clusterResource = getClusterResource(); getRootQueue().updateClusterResource(clusterResource, new ResourceLimits(clusterResource)); } finally { writeLock.unlock(); } }
@Override public synchronized void editSchedule() { updateConfigIfNeeded(); long startTs = clock.getTime(); CSQueue root = scheduler.getRootQueue(); Resource clusterResources = Resources.clone(scheduler.getClusterResource()); containerBasedPreemptOrKill(root, clusterResources); if (LOG.isDebugEnabled()) { LOG.debug("Total time used=" + (clock.getTime() - startTs) + " ms."); } }
@Lock(CapacityScheduler.class) private void initializeQueues(CapacitySchedulerConfiguration conf) throws IOException { this.queueManager.initializeQueues(conf); updatePlacementRules(); // Notify Preemption Manager preemptionManager.refreshQueues(null, this.getRootQueue()); }
@Lock(CapacityScheduler.class) private void reinitializeQueues(CapacitySchedulerConfiguration newConf) throws IOException { this.queueManager.reinitializeQueues(newConf); updatePlacementRules(); // Notify Preemption Manager preemptionManager.refreshQueues(null, this.getRootQueue()); }
private CSAssignment allocateContainersOnMultiNodes( CandidateNodeSet<FiCaSchedulerNode> candidates) { // When this time look at multiple nodes, try schedule if the // partition has any available resource or killable resource if (getRootQueue().getQueueCapacities().getUsedCapacity( candidates.getPartition()) >= 1.0f && preemptionManager.getKillableResource( CapacitySchedulerConfiguration.ROOT, candidates.getPartition()) == Resources.none()) { if (LOG.isDebugEnabled()) { LOG.debug("This node or this node partition doesn't have available or" + "killable resource"); } return null; } return allocateOrReserveNewContainers(candidates, false); }
@GET @Path(RMWSConsts.SCHEDULER) @Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 }) @Override public SchedulerTypeInfo getSchedulerInfo() { initForReadableEndpoints(); ResourceScheduler rs = rm.getResourceScheduler(); SchedulerInfo sinfo; if (rs instanceof CapacityScheduler) { CapacityScheduler cs = (CapacityScheduler) rs; CSQueue root = cs.getRootQueue(); sinfo = new CapacitySchedulerInfo(root, cs); } 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); }
@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, 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); }
ProportionalCapacityPreemptionPolicy buildPolicy(int[][] qData) { ProportionalCapacityPreemptionPolicy policy = new ProportionalCapacityPreemptionPolicy( rmContext, mCS, mClock); clusterResources = Resource.newInstance( leafAbsCapacities(qData[0], qData[7]), 0); ParentQueue mRoot = buildMockRootQueue(rand, qData); when(mCS.getRootQueue()).thenReturn(mRoot); setResourceAndNodeDetails(); return policy; }
ProportionalCapacityPreemptionPolicy buildPolicy(int[][] qData) { ProportionalCapacityPreemptionPolicy policy = new ProportionalCapacityPreemptionPolicy(conf, rmContext, mCS, mClock); clusterResources = Resource.newInstance(leafAbsCapacities(qData[0], qData[7]), 0); ParentQueue mRoot = buildMockRootQueue(rand, qData); when(mCS.getRootQueue()).thenReturn(mRoot); setResourceAndNodeDetails(); return policy; }
public void buildEnv(String labelsConfig, String nodesConfig, String queuesConfig, String appsConfig, boolean useDominantResourceCalculator) throws IOException { if (useDominantResourceCalculator) { when(cs.getResourceCalculator()).thenReturn( new DominantResourceCalculator()); } mockNodeLabelsManager(labelsConfig); mockSchedulerNodes(nodesConfig); for (NodeId nodeId : nodeIdToSchedulerNodes.keySet()) { when(cs.getSchedulerNode(nodeId)).thenReturn( nodeIdToSchedulerNodes.get(nodeId)); } List<FiCaSchedulerNode> allNodes = new ArrayList<>( nodeIdToSchedulerNodes.values()); when(cs.getAllNodes()).thenReturn(allNodes); ParentQueue root = mockQueueHierarchy(queuesConfig); when(cs.getRootQueue()).thenReturn(root); when(cs.getClusterResource()).thenReturn(clusterResource); mockApplications(appsConfig); policy = new ProportionalCapacityPreemptionPolicy(rmContext, cs, mClock); }
@Override public void editSchedule() { CSQueue root = scheduler.getRootQueue(); Resource clusterResources = Resources.clone(scheduler.getClusterResource()); clusterResources = getNonLabeledResources(clusterResources); setNodeLabels(scheduler.getRMContext().getNodeLabelManager() .getNodeLabels()); containerBasedPreemptOrKill(root, clusterResources); }
ProportionalCapacityPreemptionPolicy buildPolicy(int[][] qData, String[][] resData, boolean useDominantResourceCalculator) { if (useDominantResourceCalculator) { when(mCS.getResourceCalculator()).thenReturn( new DominantResourceCalculator()); } ProportionalCapacityPreemptionPolicy policy = new ProportionalCapacityPreemptionPolicy(rmContext, mCS, mClock); clusterResources = leafAbsCapacities(parseResourceDetails(resData[0]), qData[2]); ParentQueue mRoot = buildMockRootQueue(rand, resData, qData); when(mCS.getRootQueue()).thenReturn(mRoot); setResourceAndNodeDetails(); return policy; }
ProportionalCapacityPreemptionPolicy buildPolicy(int[][] qData, String[][] resData, boolean useDominantResourceCalculator) { if (useDominantResourceCalculator) { when(mCS.getResourceCalculator()).thenReturn( new DominantResourceCalculator()); } ProportionalCapacityPreemptionPolicy policy = new ProportionalCapacityPreemptionPolicy( conf, rmContext, mCS, mClock); clusterResources = leafAbsCapacities(parseResourceDetails(resData[0]), qData[2]); ParentQueue mRoot = buildMockRootQueue(rand, resData, qData); when(mCS.getRootQueue()).thenReturn(mRoot); setResourceAndNodeDetails(); return policy; }
@Override public void editSchedule() { CSQueue root = scheduler.getRootQueue(); Resource clusterResources = Resources.clone(scheduler.getClusterResource()); clusterResources = getNonLabeledResources(clusterResources); setNodeLabels(scheduler.getRMContext().getNodeLabelManager() .getNodeLabels()); containerBasedPreemptOrKill(root, clusterResources); }