ctx = new Context(conf);
cleanContext = true;
}
// Need to remove this static hack. But this is the way currently to get a session.
SessionState ss = SessionState.get();
session = ss.getTezSession();
session = TezSessionPoolManager.getInstance().getSession(session, conf, false);
ss.setTezSession(session);
// jobConf will hold all the configuration for hadoop, tez, and hive
JobConf jobConf = utils.createConfiguration(conf);
// Get all user jars from work (e.g. input format stuff).
String[] inputOutputJars = work.configureJobConfAndExtractJars(jobConf);
// we will localize all the files (jars, plans, hashtables) to the
// scratch dir. let's create this and tmp first.
Path scratchDir = ctx.getMRScratchDir();
// create the tez tmp dir
scratchDir = utils.createTezDir(scratchDir, conf);
// If we have any jars from input format, we need to restart the session because
// AM will need them; so, AM has to be restarted. What a mess...
if (!session.hasResources(inputOutputJars) && session.isOpen()) {
LOG.info("Tez session being reopened to pass custom jars to AM");
session.close(false);
session = TezSessionPoolManager.getInstance().getSession(null, conf, false);
ss.setTezSession(session);
}
if (!session.isOpen()) {
// can happen if the user sets the tez flag after the session was
// established