@Override public void initialize(AppSchedulingInfo appSchedulingInfo, SchedulerRequestKey schedulerRequestKey, RMContext rmContext) { super.initialize(appSchedulingInfo, schedulerRequestKey, rmContext); this.allocationTagsManager = rmContext.getAllocationTagsManager(); this.placementConstraintManager = rmContext.getPlacementConstraintManager(); } }
@Override public Map<String, Long> getAllocationTagsWithCount() { return context.getAllocationTagsManager() .getAllocationTagsWithCount(getNodeID()); }
if (rmContext != null && rmContext.getAllocationTagsManager() != null) { rmContext.getAllocationTagsManager() .removeContainer(container.getNodeId(), container.getId(), container.getAllocationTags());
@Override public void init(RMContext rmContext) { this.tagsManager = new LocalAllocationTagsManager( rmContext.getAllocationTagsManager()); this.constraintManager = rmContext.getPlacementConstraintManager(); this.resourceCalculator = rmContext.getScheduler().getResourceCalculator(); this.nodeSelector = filter -> ((AbstractYarnScheduler) (rmContext).getScheduler()) .getNodes(filter); }
@Override public void transition(RMContainerImpl container, RMContainerEvent event) { // Notify AllocationTagsManager container.rmContext.getAllocationTagsManager().addContainer( container.getNodeId(), container.getContainerId(), container.getAllocationTags()); container.eventHandler.handle( new RMAppAttemptEvent(container.appAttemptId, RMAppAttemptEventType.CONTAINER_ALLOCATED)); publishNonAMContainerEventstoATS(container); } }
schedulingRequest, schedulerNode, rmContext.getPlacementConstraintManager(), rmContext.getAllocationTagsManager())) { LOG.info("Failed to allocate container for application " + appAttempt.getApplicationId() + " on node "
.getAllocationTagsManager() .getAllocationTagsWithCount(nm1.getNodeId()); Assert.assertNotNull(nodeTags.get(testTag1)); nodeTags = rm1.getRMContext().getAllocationTagsManager() .getAllocationTagsWithCount(nm1.getNodeId()); Assert.assertNotNull(nodeTags); .getAllocationTagsManager() .getAllocationTagsWithCount(nm1.getNodeId()); return tags.get(testTag1) == null &&
when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher); AllocationTagsManager ptm = mock(AllocationTagsManager.class); when(rmContext.getAllocationTagsManager()).thenReturn(ptm);
waitForContainerAllocation(nodes.values(), am1, allocatedContainers, new ArrayList<>(), 3); printTags(nodes.values(), rm.getRMContext().getAllocationTagsManager()); Assert.assertEquals(3, allocatedContainers.size()); waitForContainerAllocation(nodes.values(), am1, allocatedContainers, new ArrayList<>(), 1); printTags(nodes.values(), rm.getRMContext().getAllocationTagsManager()); Assert.assertEquals(1, allocatedContainers.size()); NodeId barNode = allocatedContainers.get(0).getNodeId(); waitForContainerAllocation(nodes.values(), am1, allocatedContainers, rejectedContainers, 2); printTags(nodes.values(), rm.getRMContext().getAllocationTagsManager()); Assert.assertEquals(2, allocatedContainers.size()); Assert.assertTrue(allocatedContainers.stream().allMatch(
when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher); AllocationTagsManager ptm = mock(AllocationTagsManager.class); when(rmContext.getAllocationTagsManager()).thenReturn(ptm); YarnConfiguration conf = new YarnConfiguration(); conf.setBoolean(
container.rmContext.getAllocationTagsManager().addContainer( container.getNodeId(), container.getContainerId(), container.getAllocationTags());
when(rmContext.getRMApps()).thenReturn(rmApps); when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher); when(rmContext.getAllocationTagsManager()).thenReturn(tagsManager); YarnConfiguration conf = new YarnConfiguration(); conf.setBoolean(