public Boolean get() { return !rm.getRMContext().getDelegationTokenRenewer() .getDelegationTokens().contains(token1); } }, 1000, 20000);
public Boolean get() { return rm.getRMContext().getDelegationTokenRenewer().getAllTokens() .get(token1) == null; } }, 1000, 20000);
public Boolean get() { return rm.getRMContext().getDelegationTokenRenewer() .getDelegationTokens().contains(expectedToken); } }, 1000, 20000);
public Boolean get() { return rm.getRMContext().getDelegationTokenRenewer() .getDelegationTokens().contains(token2); } }, 1000, 20000);
public Boolean get() { DelegationTokenToRenew toRenew = rm.getRMContext().getDelegationTokenRenewer().getAllTokens() .get(token1); // check app conf size equals to original size and it does contain // the specific config we added. return toRenew != null && toRenew.conf != null && toRenew.conf.size() == confSize && toRenew.conf .get("dfs.namenode.rpc-address.mycluster2.nn1").equals("123.0.0.1"); } }, 200, 10000);
public MockAM waitForNewAMToLaunchAndRegister(ApplicationId appId, int attemptSize, MockNM nm) throws Exception { RMApp app = getRMContext().getRMApps().get(appId); Assert.assertNotNull(app); while (app.getAppAttempts().size() != attemptSize) { System.out.println("Application " + appId + " is waiting for AM to restart. Current has " + app.getAppAttempts().size() + " attempts."); Thread.sleep(200); } return launchAndRegisterAM(app, this, nm); }
private void failOverAndKillApp(ApplicationId appId, RMAppState initialRMAppState) throws Exception { Assert.assertEquals(initialRMAppState, rm1.getRMContext().getRMApps().get(appId).getState()); explicitFailover(); Assert.assertTrue(rm2.getRMContext().getRMApps().get(appId) == null); killApplication(rm2, appId, null, initialRMAppState); }
protected void explicitFailover() throws IOException { rm1.adminService.transitionToStandby(requestInfo); rm2.adminService.transitionToActive(requestInfo); Assert.assertTrue(rm1.getRMContext().getHAServiceState() == HAServiceState.STANDBY); Assert.assertTrue(rm2.getRMContext().getHAServiceState() == HAServiceState.ACTIVE); }
private void assertValidRMToken(String encodedToken) throws IOException { Token<RMDelegationTokenIdentifier> realToken = new Token<RMDelegationTokenIdentifier>(); realToken.decodeFromUrlString(encodedToken); RMDelegationTokenIdentifier ident = rm.getRMContext() .getRMDelegationTokenSecretManager().decodeTokenIdentifier(realToken); rm.getRMContext().getRMDelegationTokenSecretManager() .verifyToken(ident, realToken.getPassword()); assertTrue(rm.getRMContext().getRMDelegationTokenSecretManager() .getAllTokens().containsKey(ident)); }
private void doNMHeartbeat(MockRM rm, NodeId nodeId, int nHeartbeat) { CapacityScheduler cs = (CapacityScheduler) rm.getResourceScheduler(); RMNode rmNode1 = rm.getRMContext().getRMNodes().get(nodeId); for (int i = 0; i < nHeartbeat; i++) { cs.handle(new NodeUpdateSchedulerEvent(rmNode1)); } }
public void sendAMLaunchFailed(ApplicationAttemptId appAttemptId) throws Exception { MockAM am = new MockAM(getRMContext(), masterService, appAttemptId); am.waitForState(RMAppAttemptState.ALLOCATED); getRMContext().getDispatcher().getEventHandler() .handle(new RMAppAttemptEvent(appAttemptId, RMAppAttemptEventType.LAUNCH_FAILED, "Failed")); }
@Override protected void configureServlets() { bind(JAXBContextResolver.class); bind(RMWebServices.class); bind(GenericExceptionHandler.class); rm = new MockRM(new Configuration()); rm.getRMContext().getContainerTokenSecretManager().rollMasterKey(); rm.getRMContext().getNMTokenSecretManager().rollMasterKey(); bind(ResourceManager.class).toInstance(rm); serve("/*").with(GuiceContainer.class); } });
public void sendAMLaunchFailed(ApplicationAttemptId appAttemptId) throws Exception { MockAM am = new MockAM(getRMContext(), masterService, appAttemptId); waitForState(am.getApplicationAttemptId(), RMAppAttemptState.ALLOCATED); getRMContext().getDispatcher().getEventHandler() .handle(new RMAppAttemptEvent(appAttemptId, RMAppAttemptEventType.LAUNCH_FAILED, "Failed")); drainEventsImplicitly(); }
private MockRM initRM(Configuration conf) { MockRM rm = new MockRM(conf) { @Override public RMNodeLabelsManager createNodeLabelManager() { return lmgr; } }; rm.getRMContext().setNodeLabelManager(lmgr); rm.start(); Assert.assertEquals(Service.STATE.STARTED, rm.getServiceState()); return rm; }
private void checkLaunchedContainerNumOnNode(MockRM rm, NodeId nodeId, int numContainers) { CapacityScheduler cs = (CapacityScheduler) rm.getRMContext().getScheduler(); SchedulerNode node = cs.getSchedulerNode(nodeId); Assert.assertEquals(numContainers, node.getNumContainers()); }
public void sendNodeLost(MockNM nm) throws Exception { RMNodeImpl node = (RMNodeImpl) getRMContext().getRMNodes().get( nm.getNodeId()); node.handle(new RMNodeEvent(nm.getNodeId(), RMNodeEventType.EXPIRE)); drainEventsImplicitly(); }
public void sendNodeGracefulDecommission( MockNM nm, int timeout) throws Exception { RMNodeImpl node = (RMNodeImpl) getRMContext().getRMNodes().get(nm.getNodeId()); Assert.assertNotNull("node shouldn't be null", node); node.handle(new RMNodeDecommissioningEvent(nm.getNodeId(), timeout)); }
private void explicitFailover(MockRM rm) throws IOException { rm.getAdminService().transitionToStandby(requestInfo); Assert.assertTrue(rm.getRMContext() .getHAServiceState() == HAServiceProtocol.HAServiceState.STANDBY); rm.getAdminService().transitionToActive(requestInfo); Assert.assertTrue(rm.getRMContext() .getHAServiceState() == HAServiceProtocol.HAServiceState.ACTIVE); lastHearbeatTS = 0; stateStore = rm.getFederationStateStoreService().getStateStoreClient(); }
private void checkRMContainerLabelExpression(ContainerId containerId, MockRM rm, String labelExpression) { RMContainer container = rm.getRMContext().getScheduler().getRMContainer(containerId); Assert.assertNotNull("Cannot find RMContainer=" + containerId, container); Assert.assertEquals(labelExpression, container.getNodeLabelExpression()); }
private void checkPendingResource(MockRM rm, int priority, ApplicationAttemptId attemptId, int memory) { CapacityScheduler cs = (CapacityScheduler) rm.getRMContext().getScheduler(); FiCaSchedulerApp app = cs.getApplicationAttempt(attemptId); PendingAsk ask = app.getAppSchedulingInfo().getPendingAsk( TestUtils.toSchedulerKey(priority), "*"); Assert.assertEquals(memory, ask.getPerAllocationResource().getMemorySize() * ask .getCount()); }