public <N extends SchedulerNode> AppPlacementAllocator<N> getAppPlacementAllocator( SchedulerRequestKey schedulerRequestKey) { return appSchedulingInfo.getAppPlacementAllocator(schedulerRequestKey); } public void incUnconfirmedRes(Resource res) {
public int getOutstandingAsksCount(SchedulerRequestKey schedulerKey, String resourceName) { try { readLock.lock(); AppPlacementAllocator ap = appSchedulingInfo.getAppPlacementAllocator( schedulerKey); return ap == null ? 0 : ap.getOutstandingAsksCount(resourceName); } finally { readLock.unlock(); } }
public Map<String, Resource> getTotalPendingRequestsPerPartition() { try { readLock.lock(); Map<String, Resource> ret = new HashMap<>(); for (SchedulerRequestKey schedulerKey : appSchedulingInfo .getSchedulerKeys()) { AppPlacementAllocator<FiCaSchedulerNode> ps = appSchedulingInfo.getAppPlacementAllocator(schedulerKey); String nodePartition = ps.getPrimaryRequestedNodePartition(); Resource res = ret.get(nodePartition); if (null == res) { res = Resources.createResource(0); ret.put(nodePartition, res); } PendingAsk ask = ps.getPendingAsk(ResourceRequest.ANY); if (ask.getCount() > 0) { Resources.addTo(res, Resources .multiply(ask.getPerAllocationResource(), ask.getCount())); } } return ret; } finally { readLock.unlock(); } }
appSchedulingInfo.getAppPlacementAllocator(schedulerKey); if (null == ps) { LOG.warn("Failed to get " + AppPlacementAllocator.class.getName()
private void cancelPreviousRequest(SchedulerNode schedulerNode, SchedulerRequestKey schedulerKey) { AppPlacementAllocator<SchedulerNode> appPlacementAllocator = appSchedulingInfo.getAppPlacementAllocator(schedulerKey); if (appPlacementAllocator != null) { PendingAsk pendingAsk = appPlacementAllocator.getPendingAsk( ResourceRequest.ANY); // Decrement the pending using a dummy RR with // resource = prev update req capability if (pendingAsk != null && pendingAsk.getCount() > 0) { appSchedulingInfo.allocate(NodeType.OFF_SWITCH, schedulerNode, schedulerKey, Container.newInstance(UNDEFINED, schedulerNode.getNodeID(), "host:port", pendingAsk.getPerAllocationResource(), schedulerKey.getPriority(), null)); } } }
application.getAppSchedulingInfo().getAppPlacementAllocator( schedulerKey);
private void checkNodePartitionOfRequestedPriority(AppSchedulingInfo info, int priority, String expectedPartition) { for (SchedulerRequestKey key : info.getSchedulerKeys()) { if (key.getPriority().getPriority() == priority) { Assert.assertEquals("Expected partition is " + expectedPartition, expectedPartition, info.getAppPlacementAllocator(key) .getPrimaryRequestedNodePartition()); } } }
AppPlacementAllocator<FiCaSchedulerNode> ps = application.getAppSchedulingInfo() .getAppPlacementAllocator(schedulerKey); if (null == ps) { LOG.warn("Failed to get " + AppPlacementAllocator.class.getName()
appInfo.getAppPlacementAllocator(schedulerKey); if (null == appPlacementAllocator){