Search in sources :

Example 1 with TimelineACLsManager

use of org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager in project hadoop by apache.

the class EntityGroupFSTimelineStore method serviceStart.

@Override
protected void serviceStart() throws Exception {
    super.serviceStart();
    LOG.info("Starting {}", getName());
    summaryStore.start();
    Configuration conf = getConfig();
    aclManager = new TimelineACLsManager(conf);
    aclManager.setTimelineStore(summaryStore);
    summaryTdm = new TimelineDataManager(summaryStore, aclManager);
    summaryTdm.init(conf);
    addService(summaryTdm);
    // start child services that aren't already started
    super.serviceStart();
    if (!fs.exists(activeRootPath)) {
        fs.mkdirs(activeRootPath);
        fs.setPermission(activeRootPath, ACTIVE_DIR_PERMISSION);
    }
    if (!fs.exists(doneRootPath)) {
        fs.mkdirs(doneRootPath);
        fs.setPermission(doneRootPath, DONE_DIR_PERMISSION);
    }
    objMapper = new ObjectMapper();
    objMapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()));
    jsonFactory = new MappingJsonFactory(objMapper);
    final long scanIntervalSecs = conf.getLong(YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SCAN_INTERVAL_SECONDS, YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SCAN_INTERVAL_SECONDS_DEFAULT);
    final long cleanerIntervalSecs = conf.getLong(YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_CLEANER_INTERVAL_SECONDS, YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_CLEANER_INTERVAL_SECONDS_DEFAULT);
    final int numThreads = conf.getInt(YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_THREADS, YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_THREADS_DEFAULT);
    LOG.info("Scanning active directory {} every {} seconds", activeRootPath, scanIntervalSecs);
    LOG.info("Cleaning logs every {} seconds", cleanerIntervalSecs);
    executor = new ScheduledThreadPoolExecutor(numThreads, new ThreadFactoryBuilder().setNameFormat("EntityLogPluginWorker #%d").build());
    executor.scheduleAtFixedRate(new EntityLogScanner(), 0, scanIntervalSecs, TimeUnit.SECONDS);
    executor.scheduleAtFixedRate(new EntityLogCleaner(), cleanerIntervalSecs, cleanerIntervalSecs, TimeUnit.SECONDS);
}
Also used : MappingJsonFactory(com.fasterxml.jackson.databind.MappingJsonFactory) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) TimelineACLsManager(org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JaxbAnnotationIntrospector(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)

Example 2 with TimelineACLsManager

use of org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager in project hadoop by apache.

the class TestApplicationHistoryManagerOnTimelineStore method setup.

@Before
public void setup() throws Exception {
    // Only test the ACLs of the generic history
    TimelineACLsManager aclsManager = new TimelineACLsManager(new YarnConfiguration());
    aclsManager.setTimelineStore(store);
    TimelineDataManager dataManager = new TimelineDataManager(store, aclsManager);
    dataManager.init(conf);
    ApplicationACLsManager appAclsManager = new ApplicationACLsManager(conf);
    historyManager = new ApplicationHistoryManagerOnTimelineStore(dataManager, appAclsManager);
    historyManager.init(conf);
    historyManager.start();
}
Also used : TimelineDataManager(org.apache.hadoop.yarn.server.timeline.TimelineDataManager) ApplicationACLsManager(org.apache.hadoop.yarn.server.security.ApplicationACLsManager) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) TimelineACLsManager(org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager) Before(org.junit.Before)

Example 3 with TimelineACLsManager

use of org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager in project hadoop by apache.

the class TestAHSWebServices method setupClass.

@BeforeClass
public static void setupClass() throws Exception {
    conf = new YarnConfiguration();
    TimelineStore store = TestApplicationHistoryManagerOnTimelineStore.createStore(MAX_APPS);
    TimelineACLsManager aclsManager = new TimelineACLsManager(conf);
    aclsManager.setTimelineStore(store);
    TimelineDataManager dataManager = new TimelineDataManager(store, aclsManager);
    conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
    conf.set(YarnConfiguration.YARN_ADMIN_ACL, "foo");
    conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
    conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir);
    dataManager.init(conf);
    ApplicationACLsManager appAclsManager = new ApplicationACLsManager(conf);
    ApplicationHistoryManagerOnTimelineStore historyManager = new ApplicationHistoryManagerOnTimelineStore(dataManager, appAclsManager);
    historyManager.init(conf);
    historyClientService = new ApplicationHistoryClientService(historyManager) {

        @Override
        protected void serviceStart() throws Exception {
        // Do Nothing
        }
    };
    historyClientService.init(conf);
    historyClientService.start();
    ahsWebservice = new AHSWebServices(historyClientService, conf) {

        @Override
        public String getNMWebAddressFromRM(Configuration configuration, String nodeId) throws ClientHandlerException, UniformInterfaceException, JSONException {
            if (nodeId.equals(NM_ID)) {
                return NM_WEBADDRESS;
            }
            return null;
        }
    };
    fs = FileSystem.get(conf);
    GuiceServletConfig.setInjector(Guice.createInjector(new WebServletModule()));
}
Also used : ClientHandlerException(com.sun.jersey.api.client.ClientHandlerException) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) ApplicationHistoryClientService(org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryClientService) JSONException(org.codehaus.jettison.json.JSONException) TimelineACLsManager(org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager) ServletException(javax.servlet.ServletException) UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) JSONException(org.codehaus.jettison.json.JSONException) ClientHandlerException(com.sun.jersey.api.client.ClientHandlerException) TimelineDataManager(org.apache.hadoop.yarn.server.timeline.TimelineDataManager) ApplicationACLsManager(org.apache.hadoop.yarn.server.security.ApplicationACLsManager) UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) ApplicationHistoryManagerOnTimelineStore(org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManagerOnTimelineStore) TestApplicationHistoryManagerOnTimelineStore(org.apache.hadoop.yarn.server.applicationhistoryservice.TestApplicationHistoryManagerOnTimelineStore) ApplicationHistoryManagerOnTimelineStore(org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManagerOnTimelineStore) TestApplicationHistoryManagerOnTimelineStore(org.apache.hadoop.yarn.server.applicationhistoryservice.TestApplicationHistoryManagerOnTimelineStore) TimelineStore(org.apache.hadoop.yarn.server.timeline.TimelineStore) BeforeClass(org.junit.BeforeClass)

Example 4 with TimelineACLsManager

use of org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager in project hadoop by apache.

the class TestTimelineDataManager method setup.

@Before
public void setup() throws Exception {
    fsPath = new File("target", this.getClass().getSimpleName() + "-tmpDir").getAbsoluteFile();
    fsContext = FileContext.getLocalFSFileContext();
    fsContext.delete(new Path(fsPath.getAbsolutePath()), true);
    Configuration conf = new YarnConfiguration();
    conf.set(YarnConfiguration.TIMELINE_SERVICE_LEVELDB_PATH, fsPath.getAbsolutePath());
    conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_TTL_ENABLE, false);
    store = new LeveldbTimelineStore();
    store.init(conf);
    store.start();
    loadTestEntityData();
    loadVerificationEntityData();
    loadTestDomainData();
    conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, false);
    aclsManager = new TimelineACLsManager(conf);
    aclsManager.setTimelineStore(store);
    dataManaer = new TimelineDataManager(store, aclsManager);
    conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
    conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
    dataManaer.init(conf);
    adminACLsManager = new AdminACLsManager(conf);
}
Also used : Path(org.apache.hadoop.fs.Path) AdminACLsManager(org.apache.hadoop.yarn.security.AdminACLsManager) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) File(java.io.File) TimelineACLsManager(org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager) Before(org.junit.Before)

Example 5 with TimelineACLsManager

use of org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager in project hadoop by apache.

the class PluginStoreTestUtils method getTdmWithStore.

static TimelineDataManager getTdmWithStore(Configuration config, TimelineStore store) {
    TimelineACLsManager aclManager = new TimelineACLsManager(config);
    TimelineDataManager tdm = new TimelineDataManager(store, aclManager);
    tdm.init(config);
    return tdm;
}
Also used : TimelineACLsManager(org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager)

Aggregations

TimelineACLsManager (org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager)7 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)5 Configuration (org.apache.hadoop.conf.Configuration)4 TimelineDataManager (org.apache.hadoop.yarn.server.timeline.TimelineDataManager)4 ApplicationACLsManager (org.apache.hadoop.yarn.server.security.ApplicationACLsManager)3 TimelineStore (org.apache.hadoop.yarn.server.timeline.TimelineStore)2 Before (org.junit.Before)2 BeforeClass (org.junit.BeforeClass)2 MappingJsonFactory (com.fasterxml.jackson.databind.MappingJsonFactory)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JaxbAnnotationIntrospector (com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)1 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 ClientHandlerException (com.sun.jersey.api.client.ClientHandlerException)1 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)1 File (java.io.File)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 ServletException (javax.servlet.ServletException)1 Path (org.apache.hadoop.fs.Path)1 AdminACLsManager (org.apache.hadoop.yarn.security.AdminACLsManager)1 ApplicationHistoryClientService (org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryClientService)1