public AMLauncher(RMContext rmContext, RMAppAttempt application, AMLauncherEventType eventType, Configuration conf) { this.application = application; this.conf = conf; this.eventType = eventType; this.rmContext = rmContext; this.handler = rmContext.getDispatcher().getEventHandler(); this.masterContainer = application.getMasterContainer(); }
public AMLauncher(RMContext rmContext, RMAppAttempt application, AMLauncherEventType eventType, Configuration conf) { this.application = application; this.conf = conf; this.eventType = eventType; this.rmContext = rmContext; this.handler = rmContext.getDispatcher().getEventHandler(); this.masterContainer = application.getMasterContainer(); }
public AMLauncher(RMContext rmContext, RMAppAttempt application, AMLauncherEventType eventType, Configuration conf) { this.application = application; this.conf = conf; this.eventType = eventType; this.rmContext = rmContext; this.handler = rmContext.getDispatcher().getEventHandler(); this.masterContainer = application.getMasterContainer(); }
private void rejectApplicationWithMessage(ApplicationId applicationId, String msg) { LOG.info(msg); rmContext.getDispatcher().getEventHandler().handle(new RMAppEvent( applicationId, RMAppEventType.APP_REJECTED, msg)); }
/** * To be used to release a container via a Scheduler Event rather than * in the same thread. * @param container Container. */ public void asyncContainerRelease(RMContainer container) { this.rmContext.getDispatcher().getEventHandler().handle( new ReleaseContainerEvent(container)); }
@SuppressWarnings(value = "unchecked") @Override public void notifyFatalError(String errorMessage) { rmContext.getDispatcher().getEventHandler().handle( new RMFatalEvent(RMFatalEventType.EMBEDDED_ELECTOR_FAILED, errorMessage)); }
@SuppressWarnings(value = "unchecked") @Override public void notifyFatalError(String errorMessage) { rmContext.getDispatcher().getEventHandler().handle( new RMFatalEvent(RMFatalEventType.EMBEDDED_ELECTOR_FAILED, errorMessage)); }
@SuppressWarnings("unchecked") @Override protected synchronized void expire(RMAppToMonitor monitoredAppKey) { ApplicationId appId = monitoredAppKey.getApplicationId(); RMApp app = rmContext.getRMApps().get(appId); if (app == null) { return; } String diagnostics = "Application is killed by ResourceManager as it" + " has exceeded the lifetime period."; rmContext.getDispatcher().getEventHandler() .handle(new RMAppEvent(appId, RMAppEventType.KILL, diagnostics)); }
@SuppressWarnings(value = "unchecked") @Override public void notifyFatalError(String errorMessage) { rm.getRMContext().getDispatcher().getEventHandler().handle( new RMFatalEvent(RMFatalEventType.EMBEDDED_ELECTOR_FAILED, errorMessage)); }
@Override public void transition(RMNodeImpl rmNode, RMNodeEvent event) { RMNodeResourceUpdateEvent updateEvent = (RMNodeResourceUpdateEvent)event; updateNodeResourceFromEvent(rmNode, updateEvent); // Notify new resourceOption to scheduler rmNode.context.getDispatcher().getEventHandler().handle( new NodeResourceUpdateSchedulerEvent(rmNode, updateEvent.getResourceOption())); } }
@Override public void transition(RMNodeImpl rmNode, RMNodeEvent event) { RMNodeResourceUpdateEvent updateEvent = (RMNodeResourceUpdateEvent)event; updateNodeResourceFromEvent(rmNode, updateEvent); // Notify new resourceOption to scheduler rmNode.context.getDispatcher().getEventHandler().handle( new NodeResourceUpdateSchedulerEvent(rmNode, updateEvent.getResourceOption())); } }
protected void setupDispatcher(RMContext rmContext, Configuration conf) { TestDispatcher testDispatcher = new TestDispatcher(); TestAppManagerDispatcher testAppManagerDispatcher = new TestAppManagerDispatcher(); rmContext.getDispatcher().register(RMAppEventType.class, testDispatcher); rmContext.getDispatcher().register(RMAppManagerEventType.class, testAppManagerDispatcher); ((Service)rmContext.getDispatcher()).init(conf); ((Service)rmContext.getDispatcher()).start(); Assert.assertEquals("app event type is wrong before", RMAppEventType.KILL, appEventType); }
@After public void tearDown() throws Exception { ((AsyncDispatcher)this.spyRMContext.getDispatcher()).stop(); }
private void killOrphanContainerOnNode(RMNode node, NMContainerStatus container) { if (!container.getContainerState().equals(ContainerState.COMPLETE)) { this.rmContext.getDispatcher().getEventHandler().handle( new RMNodeCleanContainerEvent(node.getNodeID(), container.getContainerId())); } }
private void killOrphanContainerOnNode(RMNode node, NMContainerStatus container) { if (!container.getContainerState().equals(ContainerState.COMPLETE)) { this.rmContext.getDispatcher().getEventHandler().handle( new RMNodeCleanContainerEvent(node.getNodeID(), container.getContainerId())); } }
private void killOrphanContainerOnNode(RMNode node, NMContainerStatus container) { if (!container.getContainerState().equals(ContainerState.COMPLETE)) { this.rmContext.getDispatcher().getEventHandler().handle( new RMNodeCleanContainerEvent(node.getNodeID(), container.getContainerId())); } }
@After public void tearDown() { setAppEventType(RMAppEventType.KILL); ((Service)rmContext.getDispatcher()).stop(); UserGroupInformation.reset(); }
public void sendAMLaunchFailed(ApplicationAttemptId appAttemptId) throws Exception { MockAM am = new MockAM(getRMContext(), masterService, appAttemptId); am.waitForState(RMAppAttemptState.ALLOCATED); getRMContext().getDispatcher().getEventHandler() .handle(new RMAppAttemptEvent(appAttemptId, RMAppAttemptEventType.LAUNCH_FAILED, "Failed")); }
public void sendAMLaunchFailed(ApplicationAttemptId appAttemptId) throws Exception { MockAM am = new MockAM(getRMContext(), masterService, appAttemptId); waitForState(am.getApplicationAttemptId(), RMAppAttemptState.ALLOCATED); getRMContext().getDispatcher().getEventHandler() .handle(new RMAppAttemptEvent(appAttemptId, RMAppAttemptEventType.LAUNCH_FAILED, "Failed")); drainEventsImplicitly(); }
@Before public void setUp() throws IOException { scheduler = new FairScheduler(); conf = createConfiguration(); resourceManager = new MockRM(conf); ((AsyncDispatcher)resourceManager.getRMContext().getDispatcher()).start(); resourceManager.getRMContext().getStateStore().start(); // to initialize the master key resourceManager.getRMContext().getContainerTokenSecretManager().rollMasterKey(); scheduler.setRMContext(resourceManager.getRMContext()); }