Resource headroom = getHeadroom(); setApplicationHeadroomForMetrics(headroom); return new Allocation(allocation.getContainerList(), headroom, null, currentContPreemption, Collections.singletonList(rr), allocation.getNMTokenList());
Resource headroom = getHeadroom(); setApplicationHeadroomForMetrics(headroom); return new Allocation(allocation.getContainerList(), headroom, null, currentContPreemption, Collections.singletonList(rr), allocation.getNMTokenList());
Resource headroom = application.getHeadroom(); application.setApplicationHeadroomForMetrics(headroom); return new Allocation(allocation.getContainerList(), headroom, preemptionContainerIds, null, null, allocation.getNMTokenList());
return new Allocation(application.pullNewlyAllocatedContainers(), headroom, null, null, null, application.pullUpdatedNMTokens());
Resource headroom = application.getHeadroom(); application.setApplicationHeadroomForMetrics(headroom); return new Allocation(allocation.getContainerList(), headroom, null, null, null, allocation.getNMTokenList());
Resource headroom = application.getHeadroom(); application.setApplicationHeadroomForMetrics(headroom); return new Allocation(allocation.getContainerList(), headroom, preemptionContainerIds, null, null, allocation.getNMTokenList());
private PreemptionMessage generatePreemptionMessage( Set<ContainerId> containerToPreempt, HashMap<ContainerId, Resource> resPerCont, Resource minimumAllocation, boolean strict) { Set<ContainerId> currentContPreemption = Collections.unmodifiableSet( new HashSet<ContainerId>(containerToPreempt)); containerToPreempt.clear(); Resource tot = Resource.newInstance(0, 0); for(ContainerId c : currentContPreemption){ Resources.addTo(tot, resPerCont.get(c)); } int numCont = (int) Math.ceil(tot.getMemorySize() / (double) minimumAllocation.getMemorySize()); ResourceRequest rr = ResourceRequest.newInstance( Priority.newInstance(0), ResourceRequest.ANY, minimumAllocation, numCont); if (strict) { return generatePreemptionMessage(new Allocation(null, null, currentContPreemption, null, null)); } return generatePreemptionMessage(new Allocation(null, null, null, currentContPreemption, Collections.singletonList(rr))); }
Resource headroom = application.getHeadroom(); application.setApplicationHeadroomForMetrics(headroom); return new Allocation(allocation.getContainerList(), headroom, null, null, null, allocation.getNMTokenList());
Resource headroom = getHeadroom(); setApplicationHeadroomForMetrics(headroom); return new Allocation(newlyAllocatedContainers, headroom, null, currentContPreemption, Collections.singletonList(rr), updatedNMTokens, newlyIncreasedContainers, newlyDecreasedContainers,
.pullPreviousAttemptContainers(); List<NMToken> updatedNMTokens = application.pullUpdatedNMTokens(); return new Allocation(newlyAllocatedContainers, headroom, preemptionContainerIds, null, null, updatedNMTokens, null, null,
@SuppressWarnings("rawtypes") @Override public Allocation answer(InvocationOnMock invocation) throws Throwable { ResourceRequest rr = (ResourceRequest) ((List) invocation.getArguments()[1]).get(0); // capacity shouldn't changed assertEquals(Resource.newInstance(3333, 1), rr.getCapability()); assertEquals("label-expression", rr.getNodeLabelExpression()); // priority, #container, relax-locality will be changed assertEquals(RMAppAttemptImpl.AM_CONTAINER_PRIORITY, rr.getPriority()); assertEquals(1, rr.getNumContainers()); assertEquals(ResourceRequest.ANY, rr.getResourceName()); // just return an empty allocation List l = new ArrayList(); Set s = new HashSet(); return new Allocation(l, Resources.none(), s, s, l); } });
@SuppressWarnings("rawtypes") @Override public Allocation answer(InvocationOnMock invocation) throws Throwable { ResourceRequest rr = (ResourceRequest) ((List) invocation.getArguments()[1]).get(0); // capacity shouldn't changed assertEquals(Resource.newInstance(3333, 1), rr.getCapability()); assertEquals("label-expression", rr.getNodeLabelExpression()); // priority, #container, relax-locality will be changed assertEquals(RMAppAttemptImpl.AM_CONTAINER_PRIORITY, rr.getPriority()); assertEquals(1, rr.getNumContainers()); assertEquals(ResourceRequest.ANY, rr.getResourceName()); // just return an empty allocation List l = new ArrayList(); Set s = new HashSet(); return new Allocation(l, Resources.none(), s, s, l); } });