@Override public void collectSchedulerApplications( Collection<ApplicationAttemptId> apps) { readLock.lock(); try { for (FSAppAttempt appSched : runnableApps) { apps.add(appSched.getApplicationAttemptId()); } for (FSAppAttempt appSched : nonRunnableApps) { apps.add(appSched.getApplicationAttemptId()); } } finally { readLock.unlock(); } }
@Override public void collectSchedulerApplications( Collection<ApplicationAttemptId> apps) { readLock.lock(); try { for (FSAppAttempt appSched : runnableApps) { apps.add(appSched.getApplicationAttemptId()); } for (FSAppAttempt appSched : nonRunnableApps) { apps.add(appSched.getApplicationAttemptId()); } } finally { readLock.unlock(); } }
@Override public void collectSchedulerApplications( Collection<ApplicationAttemptId> apps) { readLock.lock(); try { for (FSAppAttempt appSched : runnableApps) { apps.add(appSched.getApplicationAttemptId()); } for (FSAppAttempt appSched : nonRunnableApps) { apps.add(appSched.getApplicationAttemptId()); } } finally { readLock.unlock(); } }
@Override public String toString() { return getApplicationAttemptId() + " Alloc: " + getCurrentConsumption(); }
/** * Remove apps that have their preemption requests fulfilled. */ private void cleanupPreemptionList() { // Synchronize separately to avoid potential deadlocks // This may cause delayed deletion of reservations LinkedList<FSAppAttempt> candidates; synchronized (this) { candidates = Lists.newLinkedList(resourcesPreemptedForApp.keySet()); } for (FSAppAttempt app : candidates) { if (app.isStopped() || !app.isStarved() || (Resources.isNone(app.getFairshareStarvation()) && Resources.isNone(app.getMinshareStarvation()))) { // App does not need more resources synchronized (this) { Resource removed = resourcesPreemptedForApp.remove(app); if (removed != null) { Resources.subtractFrom(totalResourcesPreempted, removed); appIdToAppMap.remove(app.getApplicationAttemptId()); } } } } }
/** * Mark {@code containers} as being considered for preemption so they are * not considered again. A call to this requires a corresponding call to * {@code releaseContainer} to ensure we do not mark a container for * preemption and never consider it again and avoid memory leaks. * * @param containers container to mark */ void addContainersForPreemption(Collection<RMContainer> containers, FSAppAttempt app) { Resource appReserved = Resources.createResource(0); for(RMContainer container : containers) { if(containersForPreemption.add(container)) { Resources.addTo(appReserved, container.getAllocatedResource()); } } synchronized (this) { if (!Resources.isNone(appReserved)) { Resources.addTo(totalResourcesPreempted, appReserved); appIdToAppMap.putIfAbsent(app.getApplicationAttemptId(), app); resourcesPreemptedForApp. putIfAbsent(app, Resource.newInstance(0, 0)); Resources.addTo(resourcesPreemptedForApp.get(app), appReserved); } } }
"application " + getApplicationAttemptId() + " on node " + node); unreserve(reservedSchedulerKey, node); return false; + getApplicationAttemptId() + " on node: " + node);
ApplicationAttemptId appAttemptId = mock(ApplicationAttemptId.class); when(starvingApp.getApplicationAttemptId()).thenReturn(appAttemptId); when(starvingApp.assignContainer(schedulerNode)).thenAnswer( new Answer<Resource>() {
/** * Create and return a container object reflecting an allocation for the * given appliction on the given node with the given capability and * priority. */ public Container createContainer( FSSchedulerNode node, Resource capability, Priority priority) { NodeId nodeId = node.getRMNode().getNodeID(); ContainerId containerId = BuilderUtils.newContainerId( getApplicationAttemptId(), getNewContainerId()); // Create the container Container container = BuilderUtils.newContainer(containerId, nodeId, node.getRMNode() .getHttpAddress(), capability, priority, null); return container; }
/** * Create and return a container object reflecting an allocation for the * given appliction on the given node with the given capability and * priority. */ public Container createContainer( FSSchedulerNode node, Resource capability, Priority priority) { NodeId nodeId = node.getRMNode().getNodeID(); ContainerId containerId = BuilderUtils.newContainerId( getApplicationAttemptId(), getNewContainerId()); // Create the container Container container = BuilderUtils.newContainer(containerId, nodeId, node.getRMNode() .getHttpAddress(), capability, priority, null); return container; }
+ reservedAppSchedulable.getApplicationAttemptId() + " on node " + node); reservedAppSchedulable.unreserve(reservedPriority, node); + reservedAppSchedulable.getApplicationAttemptId() + " on node: " + node);
LOG.info("Application attempt " + application.getApplicationAttemptId() + " released container " + container.getId() + " on node: " + node + " with event: " + event);
LOG.info("Application attempt " + application.getApplicationAttemptId() + " released container " + container.getId() + " on node: " + node + " with event: " + event);
/** * Create and return a container object reflecting an allocation for the * given application on the given node with the given capability and * priority. * * @param node Node * @param capability Capability * @param schedulerKey Scheduler Key * @return Container */ private Container createContainer(FSSchedulerNode node, Resource capability, SchedulerRequestKey schedulerKey) { NodeId nodeId = node.getRMNode().getNodeID(); ContainerId containerId = BuilderUtils.newContainerId( getApplicationAttemptId(), getNewContainerId()); // Create the container return BuilderUtils.newContainer(containerId, nodeId, node.getRMNode().getHttpAddress(), capability, schedulerKey.getPriority(), null, schedulerKey.getAllocationRequestId()); }
getApplicationAttemptId(), node.getNodeID(), appSchedulingInfo.getUser(), rmContext);
boolean reservableForThisApp = nodeReservedContainer == null || nodeReservedContainer.getApplicationAttemptId() .equals(getApplicationAttemptId()); if (reservableForThisApp &&!reservationExceedsThreshold(node, type)) { LOG.info("Making reservation: node=" + node.getNodeName() +
private void verifyMoveDoesNotViolateConstraints(FSAppAttempt app, FSLeafQueue oldQueue, FSLeafQueue targetQueue) throws YarnException { String queueName = targetQueue.getQueueName(); ApplicationAttemptId appAttId = app.getApplicationAttemptId();
private void verifyMoveDoesNotViolateConstraints(FSAppAttempt app, FSLeafQueue oldQueue, FSLeafQueue targetQueue) throws YarnException { String queueName = targetQueue.getQueueName(); ApplicationAttemptId appAttId = app.getApplicationAttemptId();
private void verifyMoveDoesNotViolateConstraints(FSAppAttempt app, FSLeafQueue oldQueue, FSLeafQueue targetQueue) throws YarnException { String queueName = targetQueue.getQueueName(); ApplicationAttemptId appAttId = app.getApplicationAttemptId();
scheduler.allocate(app1.getApplicationAttemptId(), new ArrayList<>(), null, Arrays.asList(containerId), null, null, NULL_UPDATE_REQUESTS);