private TezSessionPoolSession createAndInitSession( String queue, boolean isDefault, HiveConf conf) { TezSessionPoolSession sessionState = createSession(TezSessionState.makeSessionId(), conf); // TODO When will the queue ever be null. // Pass queue and default in as constructor parameters, and make them final. if (queue != null) { sessionState.setQueueName(queue); } if (isDefault) { sessionState.setDefault(); } LOG.info("Created new tez session for queue: " + queue + " with session id: " + sessionState.getSessionId()); return sessionState; }
private TezSessionPoolSession createAndInitSession(String queue, boolean isDefault) { TezSessionPoolSession sessionState = createSession(TezSessionState.makeSessionId()); // TODO When will the queue ever be null. // Pass queue and default in as constructor parameters, and make them final. if (queue != null) { sessionState.setQueueName(queue); } if (isDefault) { sessionState.setDefault(); } LOG.info("Created new tez session for queue: " + queue + " with session id: " + sessionState.getSessionId()); return sessionState; }
public void setupPool(HiveConf conf) throws InterruptedException { String defaultQueues = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_SERVER2_TEZ_DEFAULT_QUEUES); int numSessions = conf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_TEZ_SESSIONS_PER_DEFAULT_QUEUE); // the list of queues is a comma separated list. String defaultQueueList[] = defaultQueues.split(","); defaultQueuePool = new ArrayBlockingQueue<TezSessionState>(numSessions * defaultQueueList.length); this.initConf = conf; /* * with this the ordering of sessions in the queue will be (with 2 sessions 3 queues) * s1q1, s1q2, s1q3, s2q1, s2q2, s2q3 there by ensuring uniform distribution of * the sessions across queues at least to begin with. Then as sessions get freed up, the list * may change this ordering. */ blockingQueueLength = 0; for (int i = 0; i < numSessions; i++) { for (String queue : defaultQueueList) { if (queue.length() == 0) { continue; } TezSessionState sessionState = createSession(TezSessionState.makeSessionId()); sessionState.setQueueName(queue); sessionState.setDefault(); LOG.info("Created new tez session for queue: " + queue + " with session id: " + sessionState.getSessionId()); defaultQueuePool.put(sessionState); blockingQueueLength++; } } }
/** * @param conf HiveConf that is used to initialize the session * @param queueName could be null. Set in the tez session. * @param doOpen * @return * @throws Exception */ private TezSessionState getNewSessionState(HiveConf conf, String queueName, boolean doOpen) throws Exception { TezSessionState retTezSessionState = createSession(TezSessionState.makeSessionId()); if (queueName != null) { conf.set("tez.queue.name", queueName); } String what = "Created"; if (doOpen) { retTezSessionState.open(conf); openSessions.add(retTezSessionState); what = "Started"; } LOG.info(what + " a new session for queue: " + queueName + " session id: " + retTezSessionState.getSessionId()); return retTezSessionState; }