Search in sources :

Example 6 with RMStateStore

use of org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore in project hadoop by apache.

the class TestApplicationACLs method setup.

@BeforeClass
public static void setup() throws InterruptedException, IOException {
    RMStateStore store = RMStateStoreFactory.getStore(conf);
    conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
    AccessControlList adminACL = new AccessControlList("");
    adminACL.addGroup(SUPER_GROUP);
    conf.set(YarnConfiguration.YARN_ADMIN_ACL, adminACL.getAclString());
    resourceManager = new MockRM(conf) {

        @Override
        protected QueueACLsManager createQueueACLsManager(ResourceScheduler scheduler, Configuration conf) {
            QueueACLsManager mockQueueACLsManager = mock(QueueACLsManager.class);
            when(mockQueueACLsManager.checkAccess(any(UserGroupInformation.class), any(QueueACL.class), any(RMApp.class), any(String.class), any())).thenAnswer(new Answer() {

                public Object answer(InvocationOnMock invocation) {
                    return isQueueUser;
                }
            });
            return mockQueueACLsManager;
        }

        protected ClientRMService createClientRMService() {
            return new ClientRMService(getRMContext(), this.scheduler, this.rmAppManager, this.applicationACLsManager, this.queueACLsManager, null);
        }

        ;
    };
    new Thread() {

        public void run() {
            UserGroupInformation.createUserForTesting(ENEMY, new String[] {});
            UserGroupInformation.createUserForTesting(FRIEND, new String[] { FRIENDLY_GROUP });
            UserGroupInformation.createUserForTesting(SUPER_USER, new String[] { SUPER_GROUP });
            resourceManager.start();
        }

        ;
    }.start();
    int waitCount = 0;
    while (resourceManager.getServiceState() == STATE.INITED && waitCount++ < 60) {
        LOG.info("Waiting for RM to start...");
        Thread.sleep(1500);
    }
    if (resourceManager.getServiceState() != STATE.STARTED) {
        // RM could have failed.
        throw new IOException("ResourceManager failed to start. Final state is " + resourceManager.getServiceState());
    }
    UserGroupInformation owner = UserGroupInformation.createRemoteUser(APP_OWNER);
    rmClient = owner.doAs(new PrivilegedExceptionAction<ApplicationClientProtocol>() {

        @Override
        public ApplicationClientProtocol run() throws Exception {
            return (ApplicationClientProtocol) rpc.getProxy(ApplicationClientProtocol.class, rmAddress, conf);
        }
    });
}
Also used : AccessControlList(org.apache.hadoop.security.authorize.AccessControlList) RMStateStore(org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) IOException(java.io.IOException) PrivilegedExceptionAction(java.security.PrivilegedExceptionAction) ApplicationClientProtocol(org.apache.hadoop.yarn.api.ApplicationClientProtocol) Answer(org.mockito.stubbing.Answer) InvocationOnMock(org.mockito.invocation.InvocationOnMock) QueueACLsManager(org.apache.hadoop.yarn.server.resourcemanager.security.QueueACLsManager) ResourceScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation) BeforeClass(org.junit.BeforeClass)

Example 7 with RMStateStore

use of org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore in project hadoop by apache.

the class ResourceManager method deleteRMStateStore.

/**
   * Deletes the RMStateStore
   *
   * @param conf
   * @throws Exception
   */
@VisibleForTesting
static void deleteRMStateStore(Configuration conf) throws Exception {
    RMStateStore rmStore = RMStateStoreFactory.getStore(conf);
    rmStore.setResourceManager(new ResourceManager());
    rmStore.init(conf);
    rmStore.start();
    try {
        LOG.info("Deleting ResourceManager state store...");
        rmStore.deleteStore();
        LOG.info("State store deleted");
    } finally {
        rmStore.stop();
    }
}
Also used : NullRMStateStore(org.apache.hadoop.yarn.server.resourcemanager.recovery.NullRMStateStore) RMStateStore(org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 8 with RMStateStore

use of org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore in project hadoop by apache.

the class RMAppManager method recover.

@Override
public void recover(RMState state) throws Exception {
    RMStateStore store = rmContext.getStateStore();
    assert store != null;
    // recover applications
    Map<ApplicationId, ApplicationStateData> appStates = state.getApplicationState();
    LOG.info("Recovering " + appStates.size() + " applications");
    int count = 0;
    try {
        for (ApplicationStateData appState : appStates.values()) {
            recoverApplication(appState, state);
            count += 1;
        }
    } finally {
        LOG.info("Successfully recovered " + count + " out of " + appStates.size() + " applications");
    }
}
Also used : RMStateStore(org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore) ApplicationStateData(org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId)

Aggregations

RMStateStore (org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore)8 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)5 Configuration (org.apache.hadoop.conf.Configuration)4 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)4 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)3 SubmitApplicationRequest (org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest)3 Event (org.apache.hadoop.yarn.event.Event)3 RMAppEvent (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent)3 YarnScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler)3 CapacitySchedulerConfiguration (org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration)3 QueueACLsManager (org.apache.hadoop.yarn.server.resourcemanager.security.QueueACLsManager)3 RMTimelineCollectorManager (org.apache.hadoop.yarn.server.resourcemanager.timelineservice.RMTimelineCollectorManager)3 ApplicationACLsManager (org.apache.hadoop.yarn.server.security.ApplicationACLsManager)3 Test (org.junit.Test)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 GetApplicationsRequest (org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest)2 QueueACL (org.apache.hadoop.yarn.api.records.QueueACL)2 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)2