org.apache.hadoop.yarn.event.Dispatcher Java Examples
The following examples show how to use
org.apache.hadoop.yarn.event.Dispatcher.
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: TestNMWebServicesApps.java From big-c with Apache License 2.0 | 6 votes |
private HashMap<String, String> addAppContainers(Application app) throws IOException { Dispatcher dispatcher = new AsyncDispatcher(); ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId( app.getAppId(), 1); Container container1 = new MockContainer(appAttemptId, dispatcher, conf, app.getUser(), app.getAppId(), 1); Container container2 = new MockContainer(appAttemptId, dispatcher, conf, app.getUser(), app.getAppId(), 2); nmContext.getContainers() .put(container1.getContainerId(), container1); nmContext.getContainers() .put(container2.getContainerId(), container2); app.getContainers().put(container1.getContainerId(), container1); app.getContainers().put(container2.getContainerId(), container2); HashMap<String, String> hash = new HashMap<String, String>(); hash.put(container1.getContainerId().toString(), container1 .getContainerId().toString()); hash.put(container2.getContainerId().toString(), container2 .getContainerId().toString()); return hash; }
Example #2
Source File: MiniYARNClusterSplice.java From spliceengine with GNU Affero General Public License v3.0 | 6 votes |
@Override protected NodeStatusUpdater createNodeStatusUpdater(Context context, Dispatcher dispatcher, NodeHealthCheckerService healthChecker) { return new NodeStatusUpdaterImpl(context, dispatcher, healthChecker, metrics) { @Override protected ResourceTracker getRMClient() { final ResourceTrackerService rt = getResourceManager().getResourceTrackerService(); final RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null); // For in-process communication without RPC return Utils.getResourceTracker(rt); } @Override protected void stopRMProxy() { } }; }
Example #3
Source File: ResourceLocalizationService.java From hadoop with Apache License 2.0 | 6 votes |
public ResourceLocalizationService(Dispatcher dispatcher, ContainerExecutor exec, DeletionService delService, LocalDirsHandlerService dirsHandler, Context context) { super(ResourceLocalizationService.class.getName()); this.exec = exec; this.dispatcher = dispatcher; this.delService = delService; this.dirsHandler = dirsHandler; this.cacheCleanup = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder() .setNameFormat("ResourceLocalizationService Cache Cleanup") .build()); this.stateStore = context.getNMStateStore(); this.nmContext = context; }
Example #4
Source File: TestNodeStatusUpdater.java From hadoop with Apache License 2.0 | 6 votes |
@Test public void testNMShutdownForRegistrationFailure() throws Exception { nm = new NodeManagerWithCustomNodeStatusUpdater() { @Override protected NodeStatusUpdater createUpdater(Context context, Dispatcher dispatcher, NodeHealthCheckerService healthChecker) { MyNodeStatusUpdater nodeStatusUpdater = new MyNodeStatusUpdater( context, dispatcher, healthChecker, metrics); MyResourceTracker2 myResourceTracker2 = new MyResourceTracker2(); myResourceTracker2.registerNodeAction = NodeAction.SHUTDOWN; myResourceTracker2.shutDownMessage = "RM Shutting Down Node"; nodeStatusUpdater.resourceTracker = myResourceTracker2; return nodeStatusUpdater; } }; verifyNodeStartFailure( "Recieved SHUTDOWN signal from Resourcemanager ," + "Registration of NodeManager failed, " + "Message from ResourceManager: RM Shutting Down Node"); }
Example #5
Source File: RMContextImpl.java From big-c with Apache License 2.0 | 6 votes |
@VisibleForTesting // helper constructor for tests public RMContextImpl(Dispatcher rmDispatcher, ContainerAllocationExpirer containerAllocationExpirer, AMLivelinessMonitor amLivelinessMonitor, AMLivelinessMonitor amFinishingMonitor, DelegationTokenRenewer delegationTokenRenewer, AMRMTokenSecretManager appTokenSecretManager, RMContainerTokenSecretManager containerTokenSecretManager, NMTokenSecretManagerInRM nmTokenSecretManager, ClientToAMTokenSecretManagerInRM clientToAMTokenSecretManager, RMApplicationHistoryWriter rmApplicationHistoryWriter) { this( rmDispatcher, containerAllocationExpirer, amLivelinessMonitor, amFinishingMonitor, delegationTokenRenewer, appTokenSecretManager, containerTokenSecretManager, nmTokenSecretManager, clientToAMTokenSecretManager, rmApplicationHistoryWriter, null); }
Example #6
Source File: TestJobImpl.java From hadoop with Apache License 2.0 | 6 votes |
private static StubbedJob createStubbedJob(Configuration conf, Dispatcher dispatcher, int numSplits, AppContext appContext) { JobID jobID = JobID.forName("job_1234567890000_0001"); JobId jobId = TypeConverter.toYarn(jobID); if (appContext == null) { appContext = mock(AppContext.class); when(appContext.hasSuccessfullyUnregistered()).thenReturn(true); } StubbedJob job = new StubbedJob(jobId, ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 0), 0), conf,dispatcher.getEventHandler(), true, "somebody", numSplits, appContext); dispatcher.register(JobEventType.class, job); EventHandler mockHandler = mock(EventHandler.class); dispatcher.register(TaskEventType.class, mockHandler); dispatcher.register(org.apache.hadoop.mapreduce.jobhistory.EventType.class, mockHandler); dispatcher.register(JobFinishEvent.Type.class, mockHandler); return job; }
Example #7
Source File: LocalResourcesTrackerImpl.java From hadoop with Apache License 2.0 | 6 votes |
LocalResourcesTrackerImpl(String user, ApplicationId appId, Dispatcher dispatcher, ConcurrentMap<LocalResourceRequest, LocalizedResource> localrsrc, boolean useLocalCacheDirectoryManager, Configuration conf, NMStateStoreService stateStore, LocalDirsHandlerService dirHandler) { this.appId = appId; this.user = user; this.dispatcher = dispatcher; this.localrsrc = localrsrc; this.useLocalCacheDirectoryManager = useLocalCacheDirectoryManager; if (this.useLocalCacheDirectoryManager) { directoryManagers = new ConcurrentHashMap<Path, LocalCacheDirectoryManager>(); inProgressLocalResourcesMap = new ConcurrentHashMap<LocalResourceRequest, Path>(); } this.conf = conf; this.stateStore = stateStore; this.dirsHandler = dirHandler; }
Example #8
Source File: LocalResourcesTrackerImpl.java From big-c with Apache License 2.0 | 6 votes |
LocalResourcesTrackerImpl(String user, ApplicationId appId, Dispatcher dispatcher, ConcurrentMap<LocalResourceRequest,LocalizedResource> localrsrc, boolean useLocalCacheDirectoryManager, Configuration conf, NMStateStoreService stateStore) { this.appId = appId; this.user = user; this.dispatcher = dispatcher; this.localrsrc = localrsrc; this.useLocalCacheDirectoryManager = useLocalCacheDirectoryManager; if ( this.useLocalCacheDirectoryManager) { directoryManagers = new ConcurrentHashMap<Path, LocalCacheDirectoryManager>(); inProgressLocalResourcesMap = new ConcurrentHashMap<LocalResourceRequest, Path>(); } this.conf = conf; this.stateStore = stateStore; }
Example #9
Source File: MyriadOperationsTest.java From incubator-myriad with Apache License 2.0 | 6 votes |
private RMContext generateRMContext(AbstractYarnScheduler<FiCaSchedulerApp, FiCaSchedulerNode> scheduler) throws Exception { Configuration conf = new Configuration(); MockRMContext context = null; Dispatcher dispatcher = new MockDispatcher(); RMApplicationHistoryWriter rmApplicationHistoryWriter = new RMApplicationHistoryWriter(); AMLivelinessMonitor amLivelinessMonitor = new AMLivelinessMonitor(dispatcher); AMLivelinessMonitor amFinishingMonitor = new AMLivelinessMonitor(dispatcher); RMDelegationTokenSecretManager delegationTokenSecretManager = new RMDelegationTokenSecretManager(1, 1, 1, 1, context); context = new MockRMContext(); context.setStateStore(TestObjectFactory.getStateStore(conf, "tmp/myriad-operations-test")); context.setAmLivelinessMonitor(amLivelinessMonitor); context.setAmFinishingMonitor(amFinishingMonitor); context.setRMApplicationHistoryWriter(rmApplicationHistoryWriter); context.setRMDelegationTokenSecretManager(delegationTokenSecretManager); return context; }
Example #10
Source File: RMContextImpl.java From big-c with Apache License 2.0 | 6 votes |
@VisibleForTesting // helper constructor for tests public RMContextImpl(Dispatcher rmDispatcher, ContainerAllocationExpirer containerAllocationExpirer, AMLivelinessMonitor amLivelinessMonitor, AMLivelinessMonitor amFinishingMonitor, DelegationTokenRenewer delegationTokenRenewer, AMRMTokenSecretManager appTokenSecretManager, RMContainerTokenSecretManager containerTokenSecretManager, NMTokenSecretManagerInRM nmTokenSecretManager, ClientToAMTokenSecretManagerInRM clientToAMTokenSecretManager, RMApplicationHistoryWriter rmApplicationHistoryWriter, ResourceScheduler scheduler) { this(); this.setDispatcher(rmDispatcher); setActiveServiceContext(new RMActiveServiceContext(rmDispatcher, containerAllocationExpirer, amLivelinessMonitor, amFinishingMonitor, delegationTokenRenewer, appTokenSecretManager, containerTokenSecretManager, nmTokenSecretManager, clientToAMTokenSecretManager, rmApplicationHistoryWriter, scheduler)); ConfigurationProvider provider = new LocalConfigurationProvider(); setConfigurationProvider(provider); }
Example #11
Source File: TestContainerLaunch.java From big-c with Apache License 2.0 | 6 votes |
@SuppressWarnings("rawtypes") @Test (timeout = 10000) public void testCallFailureWithNullLocalizedResources() { Container container = mock(Container.class); when(container.getContainerId()).thenReturn(ContainerId.newContainerId( ApplicationAttemptId.newInstance(ApplicationId.newInstance( System.currentTimeMillis(), 1), 1), 1)); ContainerLaunchContext clc = mock(ContainerLaunchContext.class); when(clc.getCommands()).thenReturn(Collections.<String>emptyList()); when(container.getLaunchContext()).thenReturn(clc); when(container.getLocalizedResources()).thenReturn(null); Dispatcher dispatcher = mock(Dispatcher.class); EventHandler eventHandler = new EventHandler() { public void handle(Event event) { Assert.assertTrue(event instanceof ContainerExitEvent); ContainerExitEvent exitEvent = (ContainerExitEvent) event; Assert.assertEquals(ContainerEventType.CONTAINER_EXITED_WITH_FAILURE, exitEvent.getType()); } }; when(dispatcher.getEventHandler()).thenReturn(eventHandler); ContainerLaunch launch = new ContainerLaunch(context, new Configuration(), dispatcher, exec, null, container, dirsHandler, containerManager); launch.call(); }
Example #12
Source File: RMContextImpl.java From hadoop with Apache License 2.0 | 6 votes |
@VisibleForTesting // helper constructor for tests public RMContextImpl(Dispatcher rmDispatcher, ContainerAllocationExpirer containerAllocationExpirer, AMLivelinessMonitor amLivelinessMonitor, AMLivelinessMonitor amFinishingMonitor, DelegationTokenRenewer delegationTokenRenewer, AMRMTokenSecretManager appTokenSecretManager, RMContainerTokenSecretManager containerTokenSecretManager, NMTokenSecretManagerInRM nmTokenSecretManager, ClientToAMTokenSecretManagerInRM clientToAMTokenSecretManager, RMApplicationHistoryWriter rmApplicationHistoryWriter) { this( rmDispatcher, containerAllocationExpirer, amLivelinessMonitor, amFinishingMonitor, delegationTokenRenewer, appTokenSecretManager, containerTokenSecretManager, nmTokenSecretManager, clientToAMTokenSecretManager, rmApplicationHistoryWriter, null); }
Example #13
Source File: TestNMWebServicesApps.java From hadoop with Apache License 2.0 | 6 votes |
private HashMap<String, String> addAppContainers(Application app) throws IOException { Dispatcher dispatcher = new AsyncDispatcher(); ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId( app.getAppId(), 1); Container container1 = new MockContainer(appAttemptId, dispatcher, conf, app.getUser(), app.getAppId(), 1); Container container2 = new MockContainer(appAttemptId, dispatcher, conf, app.getUser(), app.getAppId(), 2); nmContext.getContainers() .put(container1.getContainerId(), container1); nmContext.getContainers() .put(container2.getContainerId(), container2); app.getContainers().put(container1.getContainerId(), container1); app.getContainers().put(container2.getContainerId(), container2); HashMap<String, String> hash = new HashMap<String, String>(); hash.put(container1.getContainerId().toString(), container1 .getContainerId().toString()); hash.put(container2.getContainerId().toString(), container2 .getContainerId().toString()); return hash; }
Example #14
Source File: TestContainerLaunch.java From hadoop with Apache License 2.0 | 6 votes |
@SuppressWarnings("rawtypes") @Test (timeout = 10000) public void testCallFailureWithNullLocalizedResources() { Container container = mock(Container.class); when(container.getContainerId()).thenReturn(ContainerId.newContainerId( ApplicationAttemptId.newInstance(ApplicationId.newInstance( System.currentTimeMillis(), 1), 1), 1)); ContainerLaunchContext clc = mock(ContainerLaunchContext.class); when(clc.getCommands()).thenReturn(Collections.<String>emptyList()); when(container.getLaunchContext()).thenReturn(clc); when(container.getLocalizedResources()).thenReturn(null); Dispatcher dispatcher = mock(Dispatcher.class); EventHandler eventHandler = new EventHandler() { public void handle(Event event) { Assert.assertTrue(event instanceof ContainerExitEvent); ContainerExitEvent exitEvent = (ContainerExitEvent) event; Assert.assertEquals(ContainerEventType.CONTAINER_EXITED_WITH_FAILURE, exitEvent.getType()); } }; when(dispatcher.getEventHandler()).thenReturn(eventHandler); ContainerLaunch launch = new ContainerLaunch(context, new Configuration(), dispatcher, exec, null, container, dirsHandler, containerManager); launch.call(); }
Example #15
Source File: RMActiveServiceContext.java From hadoop with Apache License 2.0 | 5 votes |
@Private @Unstable public RMActiveServiceContext(Dispatcher rmDispatcher, ContainerAllocationExpirer containerAllocationExpirer, AMLivelinessMonitor amLivelinessMonitor, AMLivelinessMonitor amFinishingMonitor, DelegationTokenRenewer delegationTokenRenewer, AMRMTokenSecretManager appTokenSecretManager, RMContainerTokenSecretManager containerTokenSecretManager, NMTokenSecretManagerInRM nmTokenSecretManager, ClientToAMTokenSecretManagerInRM clientToAMTokenSecretManager, RMApplicationHistoryWriter rmApplicationHistoryWriter, ResourceScheduler scheduler) { this(); this.setContainerAllocationExpirer(containerAllocationExpirer); this.setAMLivelinessMonitor(amLivelinessMonitor); this.setAMFinishingMonitor(amFinishingMonitor); this.setDelegationTokenRenewer(delegationTokenRenewer); this.setAMRMTokenSecretManager(appTokenSecretManager); this.setContainerTokenSecretManager(containerTokenSecretManager); this.setNMTokenSecretManager(nmTokenSecretManager); this.setClientToAMTokenSecretManager(clientToAMTokenSecretManager); this.setRMApplicationHistoryWriter(rmApplicationHistoryWriter); this.setScheduler(scheduler); RMStateStore nullStore = new NullRMStateStore(); nullStore.setRMDispatcher(rmDispatcher); try { nullStore.init(new YarnConfiguration()); setStateStore(nullStore); } catch (Exception e) { assert false; } }
Example #16
Source File: RecoveredContainerLaunch.java From hadoop with Apache License 2.0 | 5 votes |
public RecoveredContainerLaunch(Context context, Configuration configuration, Dispatcher dispatcher, ContainerExecutor exec, Application app, Container container, LocalDirsHandlerService dirsHandler, ContainerManagerImpl containerManager) { super(context, configuration, dispatcher, exec, app, container, dirsHandler, containerManager); this.shouldLaunchContainer.set(true); }
Example #17
Source File: TestAMRMRPCNodeUpdates.java From hadoop with Apache License 2.0 | 5 votes |
@Before public void setUp() { dispatcher = new DrainDispatcher(); this.rm = new MockRM() { @Override public void init(Configuration conf) { conf.set( CapacitySchedulerConfiguration.MAXIMUM_APPLICATION_MASTERS_RESOURCE_PERCENT, "1.0"); super.init(conf); } @Override protected EventHandler<SchedulerEvent> createSchedulerEventDispatcher() { return new SchedulerEventDispatcher(this.scheduler) { @Override public void handle(SchedulerEvent event) { scheduler.handle(event); } }; } @Override protected Dispatcher createDispatcher() { return dispatcher; } }; rm.start(); amService = rm.getApplicationMasterService(); }
Example #18
Source File: TestNodeStatusUpdater.java From big-c with Apache License 2.0 | 5 votes |
@Override protected NodeStatusUpdater createNodeStatusUpdater(Context context, Dispatcher dispatcher, NodeHealthCheckerService healthChecker) { updater = createUpdater(context, dispatcher, healthChecker); return updater; }
Example #19
Source File: LocalizedResource.java From hadoop with Apache License 2.0 | 5 votes |
public LocalizedResource(LocalResourceRequest rsrc, Dispatcher dispatcher) { this.rsrc = rsrc; this.dispatcher = dispatcher; this.ref = new LinkedList<ContainerId>(); ReadWriteLock readWriteLock = new ReentrantReadWriteLock(); this.readLock = readWriteLock.readLock(); this.writeLock = readWriteLock.writeLock(); this.stateMachine = stateMachineFactory.make(this); }
Example #20
Source File: NonAggregatingLogHandler.java From big-c with Apache License 2.0 | 5 votes |
public NonAggregatingLogHandler(Dispatcher dispatcher, DeletionService delService, LocalDirsHandlerService dirsHandler, NMStateStoreService stateStore) { super(NonAggregatingLogHandler.class.getName()); this.dispatcher = dispatcher; this.delService = delService; this.dirsHandler = dirsHandler; this.stateStore = stateStore; this.appOwners = new ConcurrentHashMap<ApplicationId, String>(); }
Example #21
Source File: NodeStatusUpdaterImpl.java From big-c with Apache License 2.0 | 5 votes |
public NodeStatusUpdaterImpl(Context context, Dispatcher dispatcher, NodeHealthCheckerService healthChecker, NodeManagerMetrics metrics) { super(NodeStatusUpdaterImpl.class.getName()); this.healthChecker = healthChecker; this.context = context; this.dispatcher = dispatcher; this.metrics = metrics; this.recentlyStoppedContainers = new LinkedHashMap<ContainerId, Long>(); this.pendingCompletedContainers = new HashMap<ContainerId, ContainerStatus>(); }
Example #22
Source File: TestNodeStatusUpdater.java From big-c with Apache License 2.0 | 5 votes |
@Override protected NodeStatusUpdater createNodeStatusUpdater(Context context, Dispatcher dispatcher, NodeHealthCheckerService healthChecker) { this.nodeStatusUpdater = new MyNodeStatusUpdater3(context, dispatcher, healthChecker, metrics); return this.nodeStatusUpdater; }
Example #23
Source File: JobHistoryServer.java From big-c with Apache License 2.0 | 5 votes |
@Override protected void serviceInit(Configuration conf) throws Exception { Configuration config = new YarnConfiguration(conf); config.setBoolean(Dispatcher.DISPATCHER_EXIT_ON_ERROR_KEY, true); // This is required for WebApps to use https if enabled. MRWebAppUtil.initialize(getConfig()); try { doSecureLogin(conf); } catch(IOException ie) { throw new YarnRuntimeException("History Server Failed to login", ie); } jobHistoryService = new JobHistory(); historyContext = (HistoryContext)jobHistoryService; stateStore = createStateStore(conf); this.jhsDTSecretManager = createJHSSecretManager(conf, stateStore); clientService = createHistoryClientService(); aggLogDelService = new AggregatedLogDeletionService(); hsAdminServer = new HSAdminServer(aggLogDelService, jobHistoryService); addService(stateStore); addService(new HistoryServerSecretManagerService()); addService(jobHistoryService); addService(clientService); addService(aggLogDelService); addService(hsAdminServer); super.serviceInit(config); }
Example #24
Source File: SystemMetricsPublisher.java From hadoop with Apache License 2.0 | 5 votes |
protected Dispatcher createDispatcher(Configuration conf) { MultiThreadedDispatcher dispatcher = new MultiThreadedDispatcher( conf.getInt( YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE, YarnConfiguration.DEFAULT_RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE)); dispatcher.setDrainEventsOnStop(); return dispatcher; }
Example #25
Source File: TestNMReconnect.java From hadoop with Apache License 2.0 | 5 votes |
@Before public void setUp() { Configuration conf = new Configuration(); // Dispatcher that processes events inline Dispatcher dispatcher = new InlineDispatcher(); dispatcher.register(RMNodeEventType.class, new TestRMNodeEventDispatcher()); RMContext context = new RMContextImpl(dispatcher, null, null, null, null, null, null, null, null, null); dispatcher.register(SchedulerEventType.class, new InlineDispatcher.EmptyEventHandler()); dispatcher.register(RMNodeEventType.class, new NodeEventDispatcher(context)); NMLivelinessMonitor nmLivelinessMonitor = new NMLivelinessMonitor( dispatcher); nmLivelinessMonitor.init(conf); nmLivelinessMonitor.start(); NodesListManager nodesListManager = new NodesListManager(context); nodesListManager.init(conf); RMContainerTokenSecretManager containerTokenSecretManager = new RMContainerTokenSecretManager(conf); containerTokenSecretManager.start(); NMTokenSecretManagerInRM nmTokenSecretManager = new NMTokenSecretManagerInRM(conf); nmTokenSecretManager.start(); resourceTrackerService = new ResourceTrackerService(context, nodesListManager, nmLivelinessMonitor, containerTokenSecretManager, nmTokenSecretManager); resourceTrackerService.init(conf); resourceTrackerService.start(); }
Example #26
Source File: TestNodeStatusUpdater.java From hadoop with Apache License 2.0 | 5 votes |
@Override protected NodeStatusUpdater createNodeStatusUpdater(Context context, Dispatcher dispatcher, NodeHealthCheckerService healthChecker) { this.nodeStatusUpdater = new MyNodeStatusUpdater3(context, dispatcher, healthChecker, metrics); return this.nodeStatusUpdater; }
Example #27
Source File: RecoveredContainerLaunch.java From big-c with Apache License 2.0 | 5 votes |
public RecoveredContainerLaunch(Context context, Configuration configuration, Dispatcher dispatcher, ContainerExecutor exec, Application app, Container container, LocalDirsHandlerService dirsHandler, ContainerManagerImpl containerManager) { super(context, configuration, dispatcher, exec, app, container, dirsHandler, containerManager); this.shouldLaunchContainer.set(true); }
Example #28
Source File: ContainerImpl.java From big-c with Apache License 2.0 | 5 votes |
public ContainerImpl(Context context,Configuration conf, Dispatcher dispatcher, NMStateStoreService stateStore, ContainerLaunchContext launchContext, Credentials creds, NodeManagerMetrics metrics, ContainerTokenIdentifier containerTokenIdentifier, RecoveredContainerStatus recoveredStatus, int exitCode, String diagnostics, boolean wasKilled, Set<Integer> cpuCores) { this(context,conf, dispatcher, stateStore, launchContext, creds, metrics, containerTokenIdentifier,cpuCores); this.recoveredStatus = recoveredStatus; this.exitCode = exitCode; this.recoveredAsKilled = wasKilled; this.diagnostics.append(diagnostics); }
Example #29
Source File: TestAppManager.java From big-c with Apache License 2.0 | 5 votes |
public RMContext mockRMContext(int n, long time) { final List<RMApp> apps = newRMApps(n, time, RMAppState.FINISHED); final ConcurrentMap<ApplicationId, RMApp> map = Maps.newConcurrentMap(); for (RMApp app : apps) { map.put(app.getApplicationId(), app); } Dispatcher rmDispatcher = new AsyncDispatcher(); ContainerAllocationExpirer containerAllocationExpirer = new ContainerAllocationExpirer( rmDispatcher); AMLivelinessMonitor amLivelinessMonitor = new AMLivelinessMonitor( rmDispatcher); AMLivelinessMonitor amFinishingMonitor = new AMLivelinessMonitor( rmDispatcher); RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class); RMContext context = new RMContextImpl(rmDispatcher, containerAllocationExpirer, amLivelinessMonitor, amFinishingMonitor, null, null, null, null, null, writer) { @Override public ConcurrentMap<ApplicationId, RMApp> getRMApps() { return map; } }; ((RMContextImpl)context).setStateStore(mock(RMStateStore.class)); metricsPublisher = mock(SystemMetricsPublisher.class); ((RMContextImpl)context).setSystemMetricsPublisher(metricsPublisher); return context; }
Example #30
Source File: TestNMExpiry.java From hadoop with Apache License 2.0 | 5 votes |
@Before public void setUp() { Configuration conf = new Configuration(); // Dispatcher that processes events inline Dispatcher dispatcher = new InlineDispatcher(); RMContext context = new RMContextImpl(dispatcher, null, null, null, null, null, null, null, null, null); dispatcher.register(SchedulerEventType.class, new InlineDispatcher.EmptyEventHandler()); dispatcher.register(RMNodeEventType.class, new NodeEventDispatcher(context)); NMLivelinessMonitor nmLivelinessMonitor = new TestNmLivelinessMonitor( dispatcher); nmLivelinessMonitor.init(conf); nmLivelinessMonitor.start(); NodesListManager nodesListManager = new NodesListManager(context); nodesListManager.init(conf); RMContainerTokenSecretManager containerTokenSecretManager = new RMContainerTokenSecretManager(conf); containerTokenSecretManager.start(); NMTokenSecretManagerInRM nmTokenSecretManager = new NMTokenSecretManagerInRM(conf); nmTokenSecretManager.start(); resourceTrackerService = new ResourceTrackerService(context, nodesListManager, nmLivelinessMonitor, containerTokenSecretManager, nmTokenSecretManager); resourceTrackerService.init(conf); resourceTrackerService.start(); }