/** * TODO: purge this once RM is doing the work * * @throws IOException */ protected void setupInitialRegistryPaths() throws IOException { if (registryOperations instanceof RMRegistryOperationsService) { RMRegistryOperationsService rmRegOperations = (RMRegistryOperationsService) registryOperations; rmRegOperations.initUserRegistryAsync(jstormMasterContext.service_user_name); } }
/** * Actions to take when an application attempt is completed * @param attemptId application ID * @throws IOException problems */ public void onApplicationAttemptUnregistered(ApplicationAttemptId attemptId) throws IOException { LOG.info("Application attempt {} unregistered, purging app attempt records", attemptId); purgeAppAttemptRecords(attemptId); }
/** * remove all application attempt entries * @param attemptId attempt ID */ protected void purgeAppAttemptRecords(ApplicationAttemptId attemptId) { purgeRecordsAsync("/", attemptId.toString(), PersistencePolicies.APPLICATION_ATTEMPT); }
@Test public void testByAppName() throws Throwable { assertSelected(false, new SelectByYarnPersistence("2", PersistencePolicies.APPLICATION)); }
/** * Queue an async operation to purge all matching records under a base path. * <ol> * <li>Uses a depth first search</li> * <li>A match is on ID and persistence policy, or, if policy==-1, any match</li> * <li>If a record matches then it is deleted without any child searches</li> * <li>Deletions will be asynchronous if a callback is provided</li> * </ol> * @param path base path * @param id ID for service record.id * @param persistencePolicyMatch ID for the persistence policy to match: * no match, no delete. * @param purgePolicy how to react to children under the entry * @param callback an optional callback * @return a future that returns the #of records deleted */ @VisibleForTesting public Future<Integer> purgeRecordsAsync(String path, String id, String persistencePolicyMatch, PurgePolicy purgePolicy, BackgroundCallback callback) { LOG.info(" records under {} with ID {} and policy {}: {}", path, id, persistencePolicyMatch); return submit( new AsyncPurge(path, new SelectByYarnPersistence(id, persistencePolicyMatch), purgePolicy, callback)); }
@Override public RMRegistryOperationsService run() throws Exception { RMRegistryOperationsService operations = new RMRegistryOperationsService("rmregistry", secureZK); addToTeardown(operations); operations.init(secureConf); LOG.info(operations.bindingDiagnosticDetails()); operations.start(); return operations; } });
@Before public void setupRegistry() throws IOException { registry = new RMRegistryOperationsService("yarnRegistry"); operations = registry; registry.init(createRegistryConfiguration()); registry.start(); operations.delete("/", true); registry.createRootRegistryPaths(); addToTeardown(registry); }
/** * Actions to take when the AM container is completed * @param containerId container ID * @throws IOException problems */ public void onAMContainerFinished(ContainerId containerId) throws IOException { LOG.info("AM Container {} finished, purging application attempt records", containerId); // remove all application attempt entries purgeAppAttemptRecords(containerId.getApplicationAttemptId()); // also treat as a container finish to remove container // level records for the AM container onContainerFinished(containerId); }
/** * Extend the parent service initialization by verifying that the * service knows —in a secure cluster— the realm in which it is executing. * It needs this to properly build up the user names and hence their * access rights. * * @param conf configuration of the service * @throws Exception */ @Override protected void serviceInit(Configuration conf) throws Exception { super.serviceInit(conf); verifyRealmValidity(); }
@Test public void testByContainer() throws Throwable { assertSelected(false, new SelectByYarnPersistence("1", PersistencePolicies.CONTAINER)); }
/** * TODO: purge this once RM is doing the work * * @throws IOException */ protected void setupInitialRegistryPaths() throws IOException { if (registryOperations instanceof RMRegistryOperationsService) { RMRegistryOperationsService rmRegOperations = (RMRegistryOperationsService) registryOperations; rmRegOperations.initUserRegistryAsync(RegistryUtils.currentUser()); } }
/** * Actions to take when the AM container is completed * @param id container ID * @throws IOException problems */ public void onContainerFinished(ContainerId id) throws IOException { LOG.info("Container {} finished, purging container-level records", id); purgeRecordsAsync("/", id.toString(), PersistencePolicies.CONTAINER); }
@Test public void testByApp() throws Throwable { assertSelected(true, new SelectByYarnPersistence("1", PersistencePolicies.APPLICATION)); }
/** * TODO: purge this once RM is doing the work * @throws IOException */ protected void setupInitialRegistryPaths() throws IOException { if (registryOperations instanceof RMRegistryOperationsService) { RMRegistryOperationsService rmRegOperations = (RMRegistryOperationsService) registryOperations; rmRegOperations.initUserRegistryAsync(service_user_name); } }
/** * Actions to take when an application is completed * @param id application ID * @throws IOException problems */ public void onApplicationCompleted(ApplicationId id) throws IOException { LOG.info("Application {} completed, purging application-level records", id); purgeRecordsAsync("/", id.toString(), PersistencePolicies.APPLICATION); }
@Test public void testByAppName() throws Throwable { assertSelected(false, new SelectByYarnPersistence("2", PersistencePolicies.APPLICATION)); }
/** * This is the event where the user is known, so the user directory * can be created * @param applicationId application ID * @param user username * @throws IOException problems */ public void onStateStoreEvent(ApplicationId applicationId, String user) throws IOException { initUserRegistryAsync(user); }
@Test public void testByContainer() throws Throwable { assertSelected(false, new SelectByYarnPersistence("1", PersistencePolicies.CONTAINER)); }
/** * TODO: purge this once RM is doing the work * @throws IOException */ protected void setupInitialRegistryPaths() throws IOException { if (registryOperations instanceof RMRegistryOperationsService) { RMRegistryOperationsService rmRegOperations = (RMRegistryOperationsService) registryOperations; rmRegOperations.initUserRegistryAsync(service_user_name); } }
@Test public void testByApp() throws Throwable { assertSelected(true, new SelectByYarnPersistence("1", PersistencePolicies.APPLICATION)); }