@SuppressWarnings("unchecked") public void appACLsUpdated(RMApp app, String appViewACLs, long updatedTime) { if (publishSystemMetrics) { dispatcher.getEventHandler().handle( new ApplicationACLsUpdatedEvent( app.getApplicationId(), appViewACLs == null ? "" : appViewACLs, updatedTime)); } }
private ConcurrentMap<ApplicationId, RMApp> createRMAppsMap(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); } return map; }
@Override public Void run() throws IOException, YarnException { UpdateApplicationTimeoutsRequest request = UpdateApplicationTimeoutsRequest .newInstance(app.getApplicationId(), Collections.singletonMap( appTimeout.getTimeoutType(), appTimeout.getExpireTime())); rm.getClientRMService().updateApplicationTimeouts(request); return null; } });
@Override public boolean appExists(RMApp app) throws Exception { String appIdPath = app.getApplicationId().toString(); int split = store.getConfig().getInt(YarnConfiguration.ZK_APPID_NODE_SPLIT_INDEX, YarnConfiguration.DEFAULT_ZK_APPID_NODE_SPLIT_INDEX); return null != curatorFramework.checkExists() .forPath(store.getAppNode(appIdPath, split)); }
@Override public Void run() throws IOException, YarnException { Priority priority = Priority.newInstance(appPriority); UpdateApplicationPriorityRequest request = UpdateApplicationPriorityRequest .newInstance(app.getApplicationId(), priority); rm.getClientRMService().updateApplicationPriority(request); return null; } });
@SuppressWarnings("unchecked") public void applicationStarted(RMApp app) { if (historyServiceEnabled) { dispatcher.getEventHandler().handle( new WritingApplicationStartEvent(app.getApplicationId(), ApplicationStartData.newInstance(app.getApplicationId(), app.getName(), app.getApplicationType(), app.getQueue(), app.getUser(), app.getSubmitTime(), app.getStartTime()))); } }
@SuppressWarnings("unchecked") public void applicationStarted(RMApp app) { if (historyServiceEnabled) { dispatcher.getEventHandler().handle( new WritingApplicationStartEvent(app.getApplicationId(), ApplicationStartData.newInstance(app.getApplicationId(), app.getName(), app.getApplicationType(), app.getQueue(), app.getUser(), app.getSubmitTime(), app.getStartTime()))); } }
public static MockAM launchAndRegisterAM(RMApp app, MockRM rm, MockNM nm, Map<Set<String>, PlacementConstraint> constraints) throws Exception { MockAM am = launchAM(app, rm, nm); for (Map.Entry<Set<String>, PlacementConstraint> e : constraints.entrySet()) { am.addPlacementConstraint(e.getKey(), e.getValue()); } am.registerAppAttempt(); rm.waitForState(app.getApplicationId(), RMAppState.RUNNING); return am; }
private String getTimelineEntityDir(RMApp app) { String outputDirApp = testRootDir.getAbsolutePath() + "/" + FileSystemTimelineWriterImpl.ENTITIES_DIR + "/" + YarnConfiguration.DEFAULT_RM_CLUSTER_ID + "/" + app.getUser() + "/" + app.getName() + "/" + TimelineUtils.DEFAULT_FLOW_VERSION + "/" + app.getStartTime() + "/" + app.getApplicationId(); return outputDirApp; }
private void sendAppUpdateSavedEvent(RMApp application) { RMAppEvent event = new RMAppEvent(application.getApplicationId(), RMAppEventType.APP_UPDATE_SAVED); application.handle(event); rmDispatcher.await(); }
public static MockAM launchAndRegisterAM(RMApp app, MockRM rm, MockNM nm) throws Exception { MockAM am = launchAM(app, rm, nm); am.registerAppAttempt(); rm.waitForState(app.getApplicationId(), RMAppState.RUNNING); return am; }
public void testRemoveApplication(RMStateStoreHelper stateStoreHelper) throws Exception { RMStateStore store = stateStoreHelper.getRMStateStore(); int noOfApps = 2; ArrayList<RMApp> appList = createAndStoreApps(stateStoreHelper, store, noOfApps); RMApp rmApp1 = appList.get(0); store.removeApplication(rmApp1.getApplicationId()); Assert.assertFalse(stateStoreHelper.appExists(rmApp1)); RMApp rmApp2 = appList.get(1); Assert.assertTrue(stateStoreHelper.appExists(rmApp2)); }
protected RMApp testCreateAppFinalSaving( ApplicationSubmissionContext submissionContext) throws IOException { RMApp application = testCreateAppRunning(submissionContext); RMAppEvent finishingEvent = new RMAppEvent(application.getApplicationId(), RMAppEventType.ATTEMPT_UNREGISTERED); application.handle(finishingEvent); assertAppState(RMAppState.FINAL_SAVING, application); assertAppFinalStateSaved(application); return application; }
protected RMApp testCreateAppFinalSaving( ApplicationSubmissionContext submissionContext) throws IOException { RMApp application = testCreateAppRunning(submissionContext); RMAppEvent finishingEvent = new RMAppEvent(application.getApplicationId(), RMAppEventType.ATTEMPT_UNREGISTERED); application.handle(finishingEvent); assertAppState(RMAppState.FINAL_SAVING, application); assertAppFinalStateSaved(application); return application; }
protected RMApp testCreateAppAccepted( ApplicationSubmissionContext submissionContext) throws IOException { RMApp application = testCreateAppSubmittedNoRecovery(submissionContext); // SUBMITTED => ACCEPTED event RMAppEventType.APP_ACCEPTED RMAppEvent event = new RMAppEvent(application.getApplicationId(), RMAppEventType.APP_ACCEPTED); application.handle(event); assertStartTimeSet(application); assertAppState(RMAppState.ACCEPTED, application); return application; }
public static void finishAMAndVerifyAppState(RMApp rmApp, MockRM rm, MockNM nm, MockAM am) throws Exception { FinishApplicationMasterRequest req = FinishApplicationMasterRequest.newInstance( FinalApplicationStatus.SUCCEEDED, "", ""); am.unregisterAppAttempt(req,true); am.waitForState(RMAppAttemptState.FINISHING); nm.nodeHeartbeat(am.getApplicationAttemptId(), 1, ContainerState.COMPLETE); am.waitForState(RMAppAttemptState.FINISHED); rm.waitForState(rmApp.getApplicationId(), RMAppState.FINISHED); }
@Test public void testAppAttempts() throws Exception { rm.start(); MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048); RMApp app1 = rm.submitApp(CONTAINER_MB, "testwordcount", "user1"); amNodeManager.nodeHeartbeat(true); testAppAttemptsHelper(app1.getApplicationId().toString(), app1, MediaType.APPLICATION_JSON); rm.stop(); }
@Test public void testSingleAppsDefault() throws JSONException, Exception { rm.start(); MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048); RMApp app1 = rm.submitApp(CONTAINER_MB); amNodeManager.nodeHeartbeat(true); testSingleAppsHelper(app1.getApplicationId().toString() + "/", app1, ""); rm.stop(); }
@Test public void testSingleAppsSlash() throws JSONException, Exception { rm.start(); MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048); RMApp app1 = rm.submitApp(CONTAINER_MB); amNodeManager.nodeHeartbeat(true); testSingleAppsHelper(app1.getApplicationId().toString() + "/", app1, MediaType.APPLICATION_JSON); rm.stop(); }
protected MockAM launchAM(RMApp app, MockRM rm, MockNM nm) throws Exception { RMAppAttempt attempt = app.getCurrentAppAttempt(); nm.nodeHeartbeat(true); MockAM am = rm.sendAMLaunched(attempt.getAppAttemptId()); am.registerAppAttempt(); rm.waitForState(app.getApplicationId(), RMAppState.RUNNING); rm.waitForState(app.getCurrentAppAttempt().getAppAttemptId(), RMAppAttemptState.RUNNING); return am; }