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);
}
});
}
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();
}
}
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");
}
}
Aggregations