@Override public void becomeStandby() { try { rmContext.getRMAdminService().transitionToStandby(req); } catch (Exception e) { LOG.error("RM could not transition to Standby", e); } }
@Override public void becomeStandby() { try { rmContext.getRMAdminService().transitionToStandby(req); } catch (Exception e) { LOG.error("RM could not transition to Standby", e); } }
@Override public void notLeader() { LOG.info(rmId + " relinquish leadership"); try { rm.getRMContext().getRMAdminService() .transitionToStandby( new HAServiceProtocol.StateChangeRequestInfo( HAServiceProtocol.RequestSource.REQUEST_BY_ZKFC)); } catch (Exception e) { LOG.info(rmId + " did not transition to standby successfully."); } }
@Override public void becomeActive() throws ServiceFailedException { try { rmContext.getRMAdminService().transitionToActive(req); } catch (Exception e) { throw new ServiceFailedException("RM could not transition to Active", e); } }
@Override public void becomeActive() throws ServiceFailedException { try { rmContext.getRMAdminService().transitionToActive(req); } catch (Exception e) { throw new ServiceFailedException("RM could not transition to Active", e); } }
public String getHAZookeeperConnectionState() { return rm.getRMContext().getRMAdminService() .getHAZookeeperConnectionState(); }
public String getHAZookeeperConnectionState() { return rm.getRMContext().getRMAdminService() .getHAZookeeperConnectionState(); }
@Override public void becomeStandby() { cancelDisconnectTimer(); try { rm.getRMContext().getRMAdminService().transitionToStandby(req); } catch (Exception e) { LOG.error("RM could not transition to Standby", e); } }
@Override public void isLeader() { LOG.info(rmId + "is elected leader, transitioning to active"); try { rm.getRMContext().getRMAdminService() .transitionToActive( new HAServiceProtocol.StateChangeRequestInfo( HAServiceProtocol.RequestSource.REQUEST_BY_ZKFC)); } catch (Exception e) { LOG.info(rmId + " failed to transition to active, giving up leadership", e); notLeader(); rejoinElection(); } }
@Override public void becomeActive() throws ServiceFailedException { cancelDisconnectTimer(); try { rm.getRMContext().getRMAdminService().transitionToActive(req); } catch (Exception e) { throw new ServiceFailedException("RM could not transition to Active", e); } }
@Override public void run() { try { rm.getRMContext().getRMAdminService().transitionToStandby(req); } catch (IOException ex) { // OK to exit } } }, "Test Unreachable ZK Thread");
@Before public void setUp() { cs = mock(CapacityScheduler.class); rmContext = mock(RMContext.class); when(rmContext.getScheduler()).thenReturn(cs); when(cs.getConfiguration()).thenReturn( new CapacitySchedulerConfiguration()); adminService = mock(AdminService.class); when(rmContext.getRMAdminService()).thenReturn(adminService); confProvider = new MutableCSConfigurationProvider(rmContext); goodUpdate = new SchedConfUpdateInfo(); Map<String, String> goodUpdateMap = new HashMap<>(); goodUpdateMap.put("goodKey", "goodVal"); QueueConfigInfo goodUpdateInfo = new QueueConfigInfo("root.a", goodUpdateMap); goodUpdate.getUpdateQueueInfo().add(goodUpdateInfo); badUpdate = new SchedConfUpdateInfo(); Map<String, String> badUpdateMap = new HashMap<>(); badUpdateMap.put("badKey", "badVal"); QueueConfigInfo badUpdateInfo = new QueueConfigInfo("root.a", badUpdateMap); badUpdate.getUpdateQueueInfo().add(badUpdateInfo); }
@Override protected synchronized void serviceStart() throws Exception { startResourceManager(index); if(index == 0 && resourceManagers[index].getRMContext().isHAEnabled()) { resourceManagers[index].getRMContext().getRMAdminService() .transitionToActive(new HAServiceProtocol.StateChangeRequestInfo( HAServiceProtocol.RequestSource.REQUEST_BY_USER_FORCED)); } Configuration conf = resourceManagers[index].getConfig(); LOG.info("Starting resourcemanager " + index); LOG.info("MiniYARN ResourceManager address: " + conf.get(YarnConfiguration.RM_ADDRESS)); LOG.info("MiniYARN ResourceManager web address: " + WebAppUtils .getRMWebAppURLWithoutScheme(conf)); super.serviceStart(); }
public ClusterInfo(ResourceManager rm) { long ts = ResourceManager.getClusterTimeStamp(); this.id = ts; this.state = rm.getServiceState(); this.haState = rm.getRMContext().getHAServiceState(); this.rmStateStoreName = rm.getRMContext().getStateStore().getClass() .getName(); this.startedOn = ts; this.resourceManagerVersion = YarnVersionInfo.getVersion(); this.resourceManagerBuildVersion = YarnVersionInfo.getBuildVersion(); this.resourceManagerVersionBuiltOn = YarnVersionInfo.getDate(); this.hadoopVersion = VersionInfo.getVersion(); this.hadoopBuildVersion = VersionInfo.getBuildVersion(); this.hadoopVersionBuiltOn = VersionInfo.getDate(); this.haZooKeeperConnectionState = rm.getRMContext().getRMAdminService().getHAZookeeperConnectionState(); }
public ClusterInfo(ResourceManager rm) { long ts = ResourceManager.getClusterTimeStamp(); this.id = ts; this.state = rm.getServiceState(); this.haState = rm.getRMContext().getHAServiceState(); this.rmStateStoreName = rm.getRMContext().getStateStore().getClass() .getName(); this.startedOn = ts; this.resourceManagerVersion = YarnVersionInfo.getVersion(); this.resourceManagerBuildVersion = YarnVersionInfo.getBuildVersion(); this.resourceManagerVersionBuiltOn = YarnVersionInfo.getDate(); this.hadoopVersion = VersionInfo.getVersion(); this.hadoopBuildVersion = VersionInfo.getBuildVersion(); this.hadoopVersionBuiltOn = VersionInfo.getDate(); this.haZooKeeperConnectionState = rm.getRMContext().getRMAdminService().getHAZookeeperConnectionState(); }
@Override protected synchronized void serviceStart() throws Exception { startResourceManager(index); if(index == 0 && resourceManagers[index].getRMContext().isHAEnabled()) { resourceManagers[index].getRMContext().getRMAdminService() .transitionToActive(new HAServiceProtocol.StateChangeRequestInfo( HAServiceProtocol.RequestSource.REQUEST_BY_USER_FORCED)); } LOG.info("MiniYARN ResourceManager address: " + getConfig().get(YarnConfiguration.RM_ADDRESS)); LOG.info("MiniYARN ResourceManager web address: " + WebAppUtils.getRMWebAppURLWithoutScheme(getConfig())); super.serviceStart(); }
@Override public Void run() throws Exception { MutableConfigurationProvider provider = ((MutableConfScheduler) scheduler).getMutableConfProvider(); if (!provider.getAclMutationPolicy().isMutationAllowed(callerUGI, mutationInfo)) { throw new org.apache.hadoop.security.AccessControlException("User" + " is not admin of all modified queues."); } provider.logAndApplyMutation(callerUGI, mutationInfo); try { rm.getRMContext().getRMAdminService().refreshQueues(); } catch (IOException | YarnException e) { provider.confirmPendingMutation(false); throw e; } provider.confirmPendingMutation(true); return null; } });
resourceManagers[i].getRMContext().getRMAdminService() .getServiceStatus().getState()) { return i;
resourceManagers[i].getRMContext().getRMAdminService() .getServiceStatus().getState()) { return i;
@Test public void testFormatStateStoreCmdForZK() throws Exception { StateChangeRequestInfo req = new StateChangeRequestInfo( HAServiceProtocol.RequestSource.REQUEST_BY_USER); try (TestingServer curatorTestingServer = TestZKRMStateStore.setupCuratorServer(); CuratorFramework curatorFramework = TestZKRMStateStore. setupCuratorFramework(curatorTestingServer)) { Configuration conf = TestZKRMStateStore.createHARMConf("rm1,rm2", "rm1", 1234, false, curatorTestingServer); ResourceManager rm = new MockRM(conf); rm.start(); rm.getRMContext().getRMAdminService().transitionToActive(req); String zkStateRoot = ZKRMStateStore.ROOT_ZNODE_NAME; assertEquals("RM State store parent path should have a child node " + zkStateRoot, zkStateRoot, curatorFramework.getChildren().forPath( YarnConfiguration.DEFAULT_ZK_RM_STATE_STORE_PARENT_PATH).get(0)); rm.close(); try { ResourceManager.deleteRMStateStore(conf); } catch (Exception e) { fail("Exception should not be thrown during format rm state store" + " operation."); } assertTrue("After store format parent path should have no child nodes", curatorFramework.getChildren().forPath( YarnConfiguration.DEFAULT_ZK_RM_STATE_STORE_PARENT_PATH).isEmpty()); } }