@Override protected LogAggregationStatus getLogAggregationStatus() { RMApp rmApp = this.rm.getRMContext().getRMApps().get(appID); if (rmApp == null) { return null; } return rmApp.getLogAggregationStatusForAppReport(); }
/** * Check if node in decommissioning state. * @param nodeId */ private boolean isNodeInDecommissioning(NodeId nodeId) { RMNode rmNode = this.rmContext.getRMNodes().get(nodeId); if (rmNode != null && rmNode.getState().equals(NodeState.DECOMMISSIONING)) { return true; } return false; }
public AMLauncher(RMContext rmContext, RMAppAttempt application, AMLauncherEventType eventType, Configuration conf) { this.application = application; this.conf = conf; this.eventType = eventType; this.rmContext = rmContext; this.handler = rmContext.getDispatcher().getEventHandler(); this.masterContainer = application.getMasterContainer(); }
@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); }
private void refreshActiveServicesAcls() throws IOException, YarnException { PolicyProvider policyProvider = RMPolicyProvider.getInstance(); Configuration conf = getConfiguration(new Configuration(false), YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE); rmContext.getClientRMService().refreshServiceAcls(conf, policyProvider); rmContext.getApplicationMasterService().refreshServiceAcls( conf, policyProvider); rmContext.getResourceTrackerService().refreshServiceAcls( conf, policyProvider); }
private void removeCredentials(RMAppAttemptImpl appAttempt) { // Unregister from the ClientToAMTokenSecretManager if (UserGroupInformation.isSecurityEnabled()) { appAttempt.rmContext.getClientToAMTokenSecretManager() .unRegisterApplication(appAttempt.getAppAttemptId()); } // Remove the AppAttempt from the AMRMTokenSecretManager appAttempt.rmContext.getAMRMTokenSecretManager() .applicationMasterFinished(appAttempt.getAppAttemptId()); }
@Before public void setUp() throws Exception { conf = new YarnConfiguration(); conf.setClass(YarnConfiguration.RM_SCHEDULER, FifoSchedulerWithMove.class, FifoSchedulerWithMove.class); conf.set(YarnConfiguration.YARN_ADMIN_ACL, " "); conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); resourceManager = new MockRM(conf); resourceManager.getRMContext().getContainerTokenSecretManager().rollMasterKey(); resourceManager.getRMContext().getNMTokenSecretManager().rollMasterKey(); resourceManager.start(); failMove = false; }
@Override protected void submitApplication( ApplicationSubmissionContext submissionContext, long submitTime, String user) throws YarnException { //Do nothing, just add the application to RMContext RMAppImpl application = new RMAppImpl(submissionContext.getApplicationId(), this.rmContext, this.conf, submissionContext.getApplicationName(), user, submissionContext.getQueue(), submissionContext, this.rmContext.getScheduler(), this.rmContext.getApplicationMasterService(), submitTime, submissionContext.getApplicationType(), submissionContext.getApplicationTags(), null); this.rmContext.getRMApps().put(submissionContext.getApplicationId(), application); //Do not send RMAppEventType.START event //so the state of Application will not reach to NEW_SAVING state. } }
@Override public void becomeStandby() { try { rmContext.getRMAdminService().transitionToStandby(req); } catch (Exception e) { LOG.error("RM could not transition to Standby", e); } }
@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()); }
@Override public Set<String> getNodeLabels() { RMNodeLabelsManager nlm = context.getNodeLabelManager(); if (nlm == null || nlm.getLabelsOnNode(nodeId) == null) { return CommonNodeLabelsManager.EMPTY_STRING_SET; } return nlm.getLabelsOnNode(nodeId); }
private boolean isSchedulerMutable() { ResourceScheduler scheduler = rm.getRMContext().getScheduler(); return (scheduler instanceof MutableConfScheduler && ((MutableConfScheduler) scheduler).isConfigurationMutable()); }
public void unregisterAttempt(ApplicationAttemptId attemptId) { LOG.info("Unregistering app attempt : " + attemptId); responseMap.remove(attemptId); rmContext.getNMTokenSecretManager().unregisterApplicationAttempt(attemptId); }
private RMNode getRMNode(NodeId nodeId) { RMNode node = getRMContext().getRMNodes().get(nodeId); if (node == null) { node = getRMContext().getInactiveRMNodes().get(nodeId); } return node; }
@Override public void transition(RMAppAttemptImpl appAttempt, RMAppAttemptEvent event) { // create AMRMToken appAttempt.amrmToken = appAttempt.rmContext.getAMRMTokenSecretManager().createAndGetAMRMToken( appAttempt.applicationAttemptId); appAttempt.registerClientToken(); super.transition(appAttempt, event); } }
@Override public synchronized RMContainerTokenSecretManager getContainerTokenSecretManager() { return this.rmContext.getContainerTokenSecretManager(); }
private static RMContext getMockRMContext() { RMContext rmContext = mock(RMContext.class); RMNodeLabelsManager nlm = new NullRMNodeLabelsManager(); nlm.init(new Configuration(false)); when(rmContext.getYarnConfiguration()).thenReturn(conf); rmContext.getYarnConfiguration().set(YarnConfiguration.NODE_LABELS_ENABLED, "true"); when(rmContext.getNodeLabelManager()).thenReturn(nlm); return rmContext; }
@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(); }
private RMApp createRMApp(Configuration conf) { ApplicationSubmissionContext submissionContext = ApplicationSubmissionContext .newInstance(appId, "test", "default", Priority.newInstance(0), mock(ContainerLaunchContext.class), false, true, 2, Resource.newInstance(10, 2), "test"); return new RMAppImpl(this.appId, this.rmContext, conf, "test", "test", "default", submissionContext, scheduler, this.rmContext.getApplicationMasterService(), System.currentTimeMillis(), "test", null, null); } }
@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); } });