return defaultSessionPool.getSession();
WmTezSession oob = pool.getSession(); plan.setMappings(Lists.newArrayList(mapping("A", "A"))); wm.updateResourcePlanAsync(plan); WmTezSession oob2 = pool.getSession(), oob3 = pool.getSession(), oob4 = pool.getSession(); pool.returnSession(oob2); assertEquals(1, pool.getCurrentSize()); plan.setMappings(Lists.newArrayList(mapping("A", "A"))); wm.updateResourcePlanAsync(plan); oob2 = pool.getSession(); oob3 = pool.getSession(); assertEquals(0, pool.getCurrentSize()); plan = new WMFullResourcePlan(plan(), Lists.newArrayList(pool("A", 1, 1.0f)));
SampleTezSessionState theOnlySession = (SampleTezSessionState) pool.getSession(); SettableFuture<Boolean> blockedWait = SettableFuture.create(); theOnlySession.setWaitForAmRegistryFuture(blockedWait);
private SampleTezSessionState validatePoolAfterCleanup( SampleTezSessionState oldSession, HiveConf conf, WorkloadManager wm, TezSessionPool<WmTezSession> pool, String sessionPoolName) throws Exception { // Make sure the cleanup doesn't leave the pool without a session. SampleTezSessionState theOnlySession = (SampleTezSessionState) pool.getSession(); assertNotNull(theOnlySession); theOnlySession.setWaitForAmRegistryFuture(null); assertNull(oldSession.getPoolName()); assertFalse(oldSession.hasClusterFraction()); pool.returnSession(theOnlySession); // Make sure we can actually get a session still - parallelism/etc. should not be affected. WmTezSession result = (WmTezSession) wm.getSession(null, mappingInput("A"), conf); assertEquals(sessionPoolName, result.getPoolName()); assertEquals(1f, result.getClusterFraction(), EPSILON); result.returnToSessionManager(); return theOnlySession; }