Search in sources :

Example 1 with ApplicationHistoryStore

use of org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryStore in project hadoop by apache.

the class TestRMApplicationHistoryWriter method setup.

@Before
public void setup() {
    store = new MemoryApplicationHistoryStore();
    Configuration conf = new Configuration();
    conf.setBoolean(YarnConfiguration.APPLICATION_HISTORY_ENABLED, true);
    conf.setClass(YarnConfiguration.APPLICATION_HISTORY_STORE, MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
    writer = new RMApplicationHistoryWriter() {

        @Override
        protected ApplicationHistoryStore createApplicationHistoryStore(Configuration conf) {
            return store;
        }

        @Override
        protected Dispatcher createDispatcher(Configuration conf) {
            MultiThreadedDispatcher dispatcher = new MultiThreadedDispatcher(conf.getInt(YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE, YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
            dispatcher.setDrainEventsOnStop();
            return dispatcher;
        }

        class MultiThreadedDispatcher extends RMApplicationHistoryWriter.MultiThreadedDispatcher {

            public MultiThreadedDispatcher(int num) {
                super(num);
            }

            @Override
            protected AsyncDispatcher createDispatcher() {
                CounterDispatcher dispatcher = new CounterDispatcher();
                dispatchers.add(dispatcher);
                return dispatcher;
            }
        }
    };
    writer.init(conf);
    writer.start();
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) FairSchedulerConfiguration(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration) Configuration(org.apache.hadoop.conf.Configuration) MemoryApplicationHistoryStore(org.apache.hadoop.yarn.server.applicationhistoryservice.MemoryApplicationHistoryStore) Dispatcher(org.apache.hadoop.yarn.event.Dispatcher) AsyncDispatcher(org.apache.hadoop.yarn.event.AsyncDispatcher) MemoryApplicationHistoryStore(org.apache.hadoop.yarn.server.applicationhistoryservice.MemoryApplicationHistoryStore) ApplicationHistoryStore(org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryStore) Before(org.junit.Before)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)1 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)1 AsyncDispatcher (org.apache.hadoop.yarn.event.AsyncDispatcher)1 Dispatcher (org.apache.hadoop.yarn.event.Dispatcher)1 ApplicationHistoryStore (org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryStore)1 MemoryApplicationHistoryStore (org.apache.hadoop.yarn.server.applicationhistoryservice.MemoryApplicationHistoryStore)1 FairSchedulerConfiguration (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration)1 Before (org.junit.Before)1