@Override protected LogAggregationStatus getLogAggregationStatus() { RMApp rmApp = this.rm.getRMContext().getRMApps().get(appID); if (rmApp == null) { return null; } return rmApp.getLogAggregationStatusForAppReport(); }
private RMAppAttempt getRMAppAttempt() { ApplicationId appId = this.appAttemptId.getApplicationId(); RMAppAttempt attempt = null; RMApp rmApp = rm.getRMContext().getRMApps().get(appId); if (rmApp != null) { attempt = rmApp.getAppAttempts().get(appAttemptId); } return attempt; }
@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."); } }
private boolean isSchedulerMutable() { ResourceScheduler scheduler = rm.getRMContext().getScheduler(); return (scheduler instanceof MutableConfScheduler && ((MutableConfScheduler) scheduler).isConfigurationMutable()); }
@Inject QueuesBlock(ResourceManager rm, CSQInfo info) { cs = (CapacityScheduler) rm.getResourceScheduler(); csqinfo = info; this.rm = rm; RMNodeLabelsManager nodeLabelManager = rm.getRMContext().getNodeLabelManager(); nodeLabelsInfo = nodeLabelManager.pullRMNodeLabelsInfo(); }
private void refreshClusterMaxPriority() throws IOException, YarnException { Configuration conf = getConfiguration(new Configuration(false), YarnConfiguration.YARN_SITE_CONFIGURATION_FILE); rm.getRMContext().getScheduler().setClusterMaxPriority(conf); }
private void refreshActiveServicesAcls() throws IOException, YarnException { PolicyProvider policyProvider = RMPolicyProvider.getInstance(); Configuration conf = getConfiguration(new Configuration(false), YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE); rm.getRMContext().getClientRMService().refreshServiceAcls(conf, policyProvider); rm.getRMContext().getApplicationMasterService().refreshServiceAcls( conf, policyProvider); rm.getRMContext().getResourceTrackerService().refreshServiceAcls( conf, policyProvider); }
@Override protected void removeStoredMasterKey(DelegationKey key) { try { LOG.info("removing master key with keyID " + key.getKeyId()); rm.getRMContext().getStateStore().removeRMDTMasterKey(key); } catch (Exception e) { if (!shouldIgnoreException(e)) { LOG.error("Error in removing master key with KeyID: " + key.getKeyId()); ExitUtil.terminate(1, e); } } }
@SuppressWarnings(value = "unchecked") @Override public void notifyFatalError(String errorMessage) { rm.getRMContext().getDispatcher().getEventHandler().handle( new RMFatalEvent(RMFatalEventType.EMBEDDED_ELECTOR_FAILED, errorMessage)); }
private static ResourceManager mockRmWithApps(RMContext rmContext) throws IOException { ResourceManager rm = mock(ResourceManager.class); ResourceScheduler rs = mockFairSchedulerWithoutApps(rmContext); ClientRMService clientRMService = mockClientRMService(rmContext); when(rm.getResourceScheduler()).thenReturn(rs); when(rm.getRMContext()).thenReturn(rmContext); when(rm.getClientRMService()).thenReturn(clientRMService); return rm; }
public static ResourceManager mockRm(RMContext rmContext) throws IOException { ResourceManager rm = mock(ResourceManager.class); ResourceScheduler rs = mockCapacityScheduler(); ApplicationACLsManager aclMgr = mockAppACLsManager(); ClientRMService clientRMService = mockClientRMService(rmContext); when(rm.getResourceScheduler()).thenReturn(rs); when(rm.getRMContext()).thenReturn(rmContext); when(rm.getApplicationACLsManager()).thenReturn(aclMgr); when(rm.getClientRMService()).thenReturn(clientRMService); return rm; }
@Before public void setUp() throws IOException { scheduler = new FairScheduler(); conf = createConfiguration(); resourceManager = new MockRM(conf); ((AsyncDispatcher)resourceManager.getRMContext().getDispatcher()).start(); resourceManager.getRMContext().getStateStore().start(); // to initialize the master key resourceManager.getRMContext().getContainerTokenSecretManager().rollMasterKey(); scheduler.setRMContext(resourceManager.getRMContext()); }
private void nodeUpdate(NodeManager nm) { RMNode node = resourceManager.getRMContext().getRMNodes().get(nm.getNodeId()); // Send a heartbeat to kick the tires on the Scheduler NodeUpdateSchedulerEvent nodeUpdate = new NodeUpdateSchedulerEvent(node); resourceManager.getResourceScheduler().handle(nodeUpdate); }
private void nodeUpdate(ResourceManager rm, NodeManager nm) { RMNode node = rm.getRMContext().getRMNodes().get(nm.getNodeId()); // Send a heartbeat to kick the tires on the Scheduler NodeUpdateSchedulerEvent nodeUpdate = new NodeUpdateSchedulerEvent(node); rm.getResourceScheduler().handle(nodeUpdate); }
private NodeManager registerNode(ResourceManager rm, String hostName, int containerManagerPort, int httpPort, String rackName, Resource capability) throws IOException, YarnException { NodeManager nm = new NodeManager(hostName, containerManagerPort, httpPort, rackName, capability, rm); NodeAddedSchedulerEvent nodeAddEvent1 = new NodeAddedSchedulerEvent(rm.getRMContext().getRMNodes() .get(nm.getNodeId())); rm.getResourceScheduler().handle(nodeAddEvent1); return nm; }
private NodeManager registerNode(String hostName, int containerManagerPort, int httpPort, String rackName, Resource capability) throws IOException, YarnException { NodeManager nm = new NodeManager(hostName, containerManagerPort, httpPort, rackName, capability, resourceManager); NodeAddedSchedulerEvent nodeAddEvent1 = new NodeAddedSchedulerEvent(resourceManager.getRMContext().getRMNodes() .get(nm.getNodeId())); resourceManager.getResourceScheduler().handle(nodeAddEvent1); return nm; }
@Before public void setUp() throws Exception { Configuration conf = new YarnConfiguration(); UserGroupInformation.setConfiguration(conf); resourceManager = new ResourceManager(); resourceManager.init(conf); resourceManager.getRMContext().getContainerTokenSecretManager().rollMasterKey(); resourceManager.getRMContext().getNMTokenSecretManager().rollMasterKey(); }
@Before public void setUp() throws Exception { super.setUp(); curatorTestingServer = setupCuratorServer(); curatorFramework = setupCuratorFramework(curatorTestingServer); conf.set(CommonConfigurationKeys.ZK_ADDRESS, curatorTestingServer.getConnectString()); rm = new MockRM(conf); rm.start(); rmContext = rm.getRMContext(); }
@Test (expected = YarnException.class) public void testMoveWouldViolateMaxAppsConstraints() throws Exception { scheduler.init(conf); scheduler.start(); scheduler.reinitialize(conf, resourceManager.getRMContext()); QueueManager queueMgr = scheduler.getQueueManager(); queueMgr.getLeafQueue("queue2", true); scheduler.getAllocationConfiguration().queueMaxApps.put("root.queue2", 0); ApplicationAttemptId appAttId = createSchedulingRequest(1024, 1, "queue1", "user1", 3); scheduler.moveApplication(appAttId.getApplicationId(), "queue2"); }
@Test (expected = YarnException.class) public void testMoveToNonexistentQueue() throws Exception { scheduler.init(conf); scheduler.start(); scheduler.reinitialize(conf, resourceManager.getRMContext()); scheduler.getQueueManager().getLeafQueue("queue1", true); ApplicationAttemptId appAttId = createSchedulingRequest(1024, 1, "queue1", "user1", 3); scheduler.moveApplication(appAttId.getApplicationId(), "queue2"); }