org.apache.hadoop.yarn.server.timeline.MemoryTimelineStore Java Examples

The following examples show how to use org.apache.hadoop.yarn.server.timeline.MemoryTimelineStore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestSystemMetricsPublisher.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
  conf.setBoolean(YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_ENABLED, true);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
      MemoryTimelineStore.class, TimelineStore.class);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS,
      MemoryTimelineStateStore.class, TimelineStateStore.class);
  conf.setInt(
      YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE,
      2);

  timelineServer = new ApplicationHistoryServer();
  timelineServer.init(conf);
  timelineServer.start();
  store = timelineServer.getTimelineStore();

  metricsPublisher = new SystemMetricsPublisher();
  metricsPublisher.init(conf);
  metricsPublisher.start();
}
 
Example #2
Source File: TestTimelineWebServicesWithSSL.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setupServer() throws Exception {
  conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
      MemoryTimelineStore.class, TimelineStore.class);
  conf.set(YarnConfiguration.YARN_HTTP_POLICY_KEY, "HTTPS_ONLY");

  File base = new File(BASEDIR);
  FileUtil.fullyDelete(base);
  base.mkdirs();
  keystoresDir = new File(BASEDIR).getAbsolutePath();
  sslConfDir =
      KeyStoreTestUtil.getClasspathDir(TestTimelineWebServicesWithSSL.class);

  KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
  conf.addResource("ssl-server.xml");
  conf.addResource("ssl-client.xml");

  timelineServer = new ApplicationHistoryServer();
  timelineServer.init(conf);
  timelineServer.start();
  store = timelineServer.getTimelineStore();
}
 
Example #3
Source File: TestSystemMetricsPublisher.java    From big-c with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setup() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
  conf.setBoolean(YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_ENABLED, true);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
      MemoryTimelineStore.class, TimelineStore.class);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS,
      MemoryTimelineStateStore.class, TimelineStateStore.class);
  conf.setInt(
      YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE,
      2);

  timelineServer = new ApplicationHistoryServer();
  timelineServer.init(conf);
  timelineServer.start();
  store = timelineServer.getTimelineStore();

  metricsPublisher = new SystemMetricsPublisher();
  metricsPublisher.init(conf);
  metricsPublisher.start();
}
 
Example #4
Source File: TestTimelineWebServicesWithSSL.java    From big-c with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setupServer() throws Exception {
  conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
      MemoryTimelineStore.class, TimelineStore.class);
  conf.set(YarnConfiguration.YARN_HTTP_POLICY_KEY, "HTTPS_ONLY");

  File base = new File(BASEDIR);
  FileUtil.fullyDelete(base);
  base.mkdirs();
  keystoresDir = new File(BASEDIR).getAbsolutePath();
  sslConfDir =
      KeyStoreTestUtil.getClasspathDir(TestTimelineWebServicesWithSSL.class);

  KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
  conf.addResource("ssl-server.xml");
  conf.addResource("ssl-client.xml");

  timelineServer = new ApplicationHistoryServer();
  timelineServer.init(conf);
  timelineServer.start();
  store = timelineServer.getTimelineStore();
}
 
Example #5
Source File: MiniYARNCluster.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
protected synchronized void serviceInit(Configuration conf)
    throws Exception {
  appHistoryServer = new ApplicationHistoryServer();
  conf.setClass(YarnConfiguration.APPLICATION_HISTORY_STORE,
      MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
      MemoryTimelineStore.class, TimelineStore.class);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS,
      MemoryTimelineStateStore.class, TimelineStateStore.class);
  appHistoryServer.init(conf);
  super.serviceInit(conf);
}
 
Example #6
Source File: TestApplicationHistoryServer.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 60000)
public void testStartStopServer() throws Exception {
  ApplicationHistoryServer historyServer = new ApplicationHistoryServer();
  Configuration config = new YarnConfiguration();
  config.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
      MemoryTimelineStore.class, TimelineStore.class);
  config.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS,
      MemoryTimelineStateStore.class, TimelineStateStore.class);
  config.set(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, "localhost:0");
  try {
    try {
      historyServer.init(config);
      config.setInt(YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT,
          0);
      historyServer.start();
      fail();
    } catch (IllegalArgumentException e) {
      Assert.assertTrue(e.getMessage().contains(
          YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT));
    }
    config.setInt(YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT);
    historyServer = new ApplicationHistoryServer();
    historyServer.init(config);
    assertEquals(STATE.INITED, historyServer.getServiceState());
    assertEquals(5, historyServer.getServices().size());
    ApplicationHistoryClientService historyService =
        historyServer.getClientService();
    assertNotNull(historyServer.getClientService());
    assertEquals(STATE.INITED, historyService.getServiceState());

    historyServer.start();
    assertEquals(STATE.STARTED, historyServer.getServiceState());
    assertEquals(STATE.STARTED, historyService.getServiceState());
    historyServer.stop();
    assertEquals(STATE.STOPPED, historyServer.getServiceState());
  } finally {
    historyServer.stop();
  }
}
 
Example #7
Source File: TestApplicationHistoryServer.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 240000)
public void testFilterOverrides() throws Exception {

  HashMap<String, String> driver = new HashMap<String, String>();
  driver.put("", TimelineAuthenticationFilterInitializer.class.getName());
  driver.put(StaticUserWebFilter.class.getName(),
    TimelineAuthenticationFilterInitializer.class.getName() + ","
        + StaticUserWebFilter.class.getName());
  driver.put(AuthenticationFilterInitializer.class.getName(),
    TimelineAuthenticationFilterInitializer.class.getName());
  driver.put(TimelineAuthenticationFilterInitializer.class.getName(),
    TimelineAuthenticationFilterInitializer.class.getName());
  driver.put(AuthenticationFilterInitializer.class.getName() + ","
      + TimelineAuthenticationFilterInitializer.class.getName(),
    TimelineAuthenticationFilterInitializer.class.getName());
  driver.put(AuthenticationFilterInitializer.class.getName() + ", "
      + TimelineAuthenticationFilterInitializer.class.getName(),
    TimelineAuthenticationFilterInitializer.class.getName());

  for (Map.Entry<String, String> entry : driver.entrySet()) {
    String filterInitializer = entry.getKey();
    String expectedValue = entry.getValue();
    ApplicationHistoryServer historyServer = new ApplicationHistoryServer();
    Configuration config = new YarnConfiguration();
    config.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
        MemoryTimelineStore.class, TimelineStore.class);
    config.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS,
        MemoryTimelineStateStore.class, TimelineStateStore.class);
    config.set(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, "localhost:0");
    try {
      config.set("hadoop.http.filter.initializers", filterInitializer);
      historyServer.init(config);
      historyServer.start();
      Configuration tmp = historyServer.getConfig();
      assertEquals(expectedValue, tmp.get("hadoop.http.filter.initializers"));
    } finally {
      historyServer.stop();
    }
  }
}
 
Example #8
Source File: TestMemoryTimelineStore.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
  store = new MemoryTimelineStore();
  store.init(new YarnConfiguration());
  store.start();
  loadTestEntityData();
  loadVerificationEntityData();
  loadTestDomainData();
}
 
Example #9
Source File: MiniYARNCluster.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected synchronized void serviceInit(Configuration conf)
    throws Exception {
  appHistoryServer = new ApplicationHistoryServer();
  conf.setClass(YarnConfiguration.APPLICATION_HISTORY_STORE,
      MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
      MemoryTimelineStore.class, TimelineStore.class);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS,
      MemoryTimelineStateStore.class, TimelineStateStore.class);
  appHistoryServer.init(conf);
  super.serviceInit(conf);
}
 
Example #10
Source File: TestApplicationHistoryServer.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 60000)
public void testStartStopServer() throws Exception {
  ApplicationHistoryServer historyServer = new ApplicationHistoryServer();
  Configuration config = new YarnConfiguration();
  config.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
      MemoryTimelineStore.class, TimelineStore.class);
  config.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS,
      MemoryTimelineStateStore.class, TimelineStateStore.class);
  config.set(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, "localhost:0");
  try {
    try {
      historyServer.init(config);
      config.setInt(YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT,
          0);
      historyServer.start();
      fail();
    } catch (IllegalArgumentException e) {
      Assert.assertTrue(e.getMessage().contains(
          YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT));
    }
    config.setInt(YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT);
    historyServer = new ApplicationHistoryServer();
    historyServer.init(config);
    assertEquals(STATE.INITED, historyServer.getServiceState());
    assertEquals(5, historyServer.getServices().size());
    ApplicationHistoryClientService historyService =
        historyServer.getClientService();
    assertNotNull(historyServer.getClientService());
    assertEquals(STATE.INITED, historyService.getServiceState());

    historyServer.start();
    assertEquals(STATE.STARTED, historyServer.getServiceState());
    assertEquals(STATE.STARTED, historyService.getServiceState());
    historyServer.stop();
    assertEquals(STATE.STOPPED, historyServer.getServiceState());
  } finally {
    historyServer.stop();
  }
}
 
Example #11
Source File: TestApplicationHistoryServer.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 240000)
public void testFilterOverrides() throws Exception {

  HashMap<String, String> driver = new HashMap<String, String>();
  driver.put("", TimelineAuthenticationFilterInitializer.class.getName());
  driver.put(StaticUserWebFilter.class.getName(),
    TimelineAuthenticationFilterInitializer.class.getName() + ","
        + StaticUserWebFilter.class.getName());
  driver.put(AuthenticationFilterInitializer.class.getName(),
    TimelineAuthenticationFilterInitializer.class.getName());
  driver.put(TimelineAuthenticationFilterInitializer.class.getName(),
    TimelineAuthenticationFilterInitializer.class.getName());
  driver.put(AuthenticationFilterInitializer.class.getName() + ","
      + TimelineAuthenticationFilterInitializer.class.getName(),
    TimelineAuthenticationFilterInitializer.class.getName());
  driver.put(AuthenticationFilterInitializer.class.getName() + ", "
      + TimelineAuthenticationFilterInitializer.class.getName(),
    TimelineAuthenticationFilterInitializer.class.getName());

  for (Map.Entry<String, String> entry : driver.entrySet()) {
    String filterInitializer = entry.getKey();
    String expectedValue = entry.getValue();
    ApplicationHistoryServer historyServer = new ApplicationHistoryServer();
    Configuration config = new YarnConfiguration();
    config.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
        MemoryTimelineStore.class, TimelineStore.class);
    config.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS,
        MemoryTimelineStateStore.class, TimelineStateStore.class);
    config.set(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, "localhost:0");
    try {
      config.set("hadoop.http.filter.initializers", filterInitializer);
      historyServer.init(config);
      historyServer.start();
      Configuration tmp = historyServer.getConfig();
      assertEquals(expectedValue, tmp.get("hadoop.http.filter.initializers"));
    } finally {
      historyServer.stop();
    }
  }
}
 
Example #12
Source File: TestMemoryTimelineStore.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
  store = new MemoryTimelineStore();
  store.init(new YarnConfiguration());
  store.start();
  loadTestEntityData();
  loadVerificationEntityData();
  loadTestDomainData();
}
 
Example #13
Source File: MiniYARNClusterSplice.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected synchronized void serviceInit(Configuration conf)
    throws Exception {
    appHistoryServer = new ApplicationHistoryServer();
    conf.setClass(YarnConfiguration.APPLICATION_HISTORY_STORE,
                  MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
    conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
                  MemoryTimelineStore.class, TimelineStore.class);
    appHistoryServer.init(conf);
    super.serviceInit(conf);
}
 
Example #14
Source File: TestApplicationHistoryManagerOnTimelineStore.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public static TimelineStore createStore(int scale) throws Exception {
  TimelineStore store = new MemoryTimelineStore();
  prepareTimelineStore(store, scale);
  return store;
}
 
Example #15
Source File: TestApplicationHistoryManagerOnTimelineStore.java    From big-c with Apache License 2.0 4 votes vote down vote up
public static TimelineStore createStore(int scale) throws Exception {
  TimelineStore store = new MemoryTimelineStore();
  prepareTimelineStore(store, scale);
  return store;
}