@Test /** * Ensure that when negative paramaters are given (signaling delay scheduling * no tin use), the least restrictive locality level is returned. */ public void testLocalityLevelWithoutDelays() { FSLeafQueue queue = Mockito.mock(FSLeafQueue.class); Priority prio = Mockito.mock(Priority.class); Mockito.when(prio.getPriority()).thenReturn(1); RMContext rmContext = resourceManager.getRMContext(); ApplicationAttemptId applicationAttemptId = createAppAttemptId(1, 1); FSAppAttempt schedulerApp = new FSAppAttempt(scheduler, applicationAttemptId, "user1", queue , null, rmContext); assertEquals(NodeType.OFF_SWITCH, schedulerApp.getAllowedLocalityLevel( prio, 10, -1.0, -1.0)); }
scheduler.getClock().getTime()); } else { allowedLocality = getAllowedLocalityLevel(schedulerKey, scheduler.getNumClusterNodes(), scheduler.getNodeLocalityThreshold(),
scheduler.getClock().getTime()); } else { allowedLocality = getAllowedLocalityLevel(priority, scheduler.getNumClusterNodes(), scheduler.getNodeLocalityThreshold(),
@Test /** * Ensure that when negative paramaters are given (signaling delay scheduling * no tin use), the least restrictive locality level is returned. */ public void testLocalityLevelWithoutDelays() { FSLeafQueue queue = Mockito.mock(FSLeafQueue.class); Priority pri = Mockito.mock(Priority.class); SchedulerRequestKey prio = TestUtils.toSchedulerKey(pri); Mockito.when(pri.getPriority()).thenReturn(1); RMContext rmContext = resourceManager.getRMContext(); ApplicationAttemptId applicationAttemptId = createAppAttemptId(1, 1); FSAppAttempt schedulerApp = new FSAppAttempt(scheduler, applicationAttemptId, "user1", queue , null, rmContext); assertEquals(NodeType.OFF_SWITCH, schedulerApp.getAllowedLocalityLevel( prio, 10, -1.0, -1.0)); }
scheduler.getClock().getTime()); } else { allowedLocality = getAllowedLocalityLevel(priority, scheduler.getNumClusterNodes(), scheduler.getNodeLocalityThreshold(),
assertEquals(NodeType.NODE_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.NODE_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.RACK_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.NODE_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.NODE_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.RACK_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.RACK_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.OFF_SWITCH, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold));
assertEquals(NodeType.NODE_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.NODE_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.RACK_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.NODE_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.NODE_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.RACK_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.RACK_LOCAL, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold)); assertEquals(NodeType.OFF_SWITCH, schedulerApp.getAllowedLocalityLevel( prio, 10, nodeLocalityThreshold, rackLocalityThreshold));