/** * Logger an error to console if available. */ private static void log(String error) { LogHelper console = SessionState.getConsole(); if (console != null) { console.printError(error); } }
public TezJobMonitor(List<BaseWork> topSortedWorks, final DAGClient dagClient, HiveConf conf, DAG dag, Context ctx) { this.topSortedWorks = topSortedWorks; this.dagClient = dagClient; this.hiveConf = conf; this.dag = dag; this.context = ctx; console = SessionState.getConsole(); updateFunction = updateFunction(); }
private void consoleMessage(String message) { if (useConsole) { SessionState.getConsole().printInfo(message); } else { LOG.info(message); } }
private void warn(String msg) { SessionState.getConsole().printInfo( String.format("Warning: %s", msg)); }
private void warn(String msg) { SessionState.getConsole().printInfo("Warning: " + msg, false); }
/** * Logger an error to console if available. */ private void log(String error) { LogHelper console = SessionState.getConsole(); if (console != null) { console.printError(error); } }
private void warn(String msg) { SessionState.getConsole().printInfo("Warning: " + msg, false); }
public TezJobMonitor(Map<String, BaseWork> workMap, final DAGClient dagClient, HiveConf conf, DAG dag, Context ctx) { this.workMap = workMap; this.dagClient = dagClient; this.hiveConf = conf; this.dag = dag; this.context = ctx; console = SessionState.getConsole(); updateFunction = updateFunction(); }
static void registerJars(List<String> newJars) throws IllegalArgumentException { LogHelper console = getConsole(); try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); ClassLoader newLoader = Utilities.addToClassPath(loader, newJars.toArray(new String[0])); Thread.currentThread().setContextClassLoader(newLoader); SessionState.get().getConf().setClassLoader(newLoader); console.printInfo("Added " + newJars + " to class path"); } catch (Exception e) { String message = "Unable to register " + newJars; throw new IllegalArgumentException(message, e); } }
static boolean unregisterJar(List<String> jarsToUnregister) { LogHelper console = getConsole(); try { Utilities.removeFromClassPath(jarsToUnregister.toArray(new String[0])); console.printInfo("Deleted " + jarsToUnregister + " from class path"); return true; } catch (IOException e) { console.printError("Unable to unregister " + jarsToUnregister + "\nException: " + e.getMessage(), "\n" + org.apache.hadoop.util.StringUtils.stringifyException(e)); return false; } }
@Override public void preDriverRun(HiveDriverRunHookContext hookContext) throws Exception { SessionState sess = new SessionState((HiveConf)hookContext.getConf()); PrintStream stream = sess.getConsole().getOutStream(); stream.println(hookContext.getCommand()); }
@Override protected void initializeInput(ObjectInspector[] arguments) throws UDFArgumentException { if (arguments.length > 0) { super.initializeInput(arguments); } else { if (currentTimestamp == null) { currentTimestamp = new LongWritable(0); setValueFromTs(currentTimestamp, Timestamp.ofEpochMilli(SessionState.get().getQueryCurrentTimestamp().toEpochMilli())); String msg = "unix_timestamp(void) is deprecated. Use current_timestamp instead."; SessionState.getConsole().printInfo(msg, false); } } }
@Override public void beforeCompile(QueryLifeTimeHookContext ctx) { SessionState.getConsole().getOutStream().println("beforeCompile: " + ctx.getCommand()); }
@Override public void afterExecution(QueryLifeTimeHookContext ctx, boolean hasError) { SessionState.getConsole().getOutStream().println("afterExecution: " + ctx.getCommand()); } }
@Override public void afterCompile(QueryLifeTimeHookContext ctx, boolean hasError) { SessionState.getConsole().getOutStream().println("afterCompile: " + ctx.getCommand()); }
@Override public void beforeExecution(QueryLifeTimeHookContext ctx) { SessionState.getConsole().getOutStream().println("beforeExecution: " + ctx.getCommand()); }
public void run(QueryState queryState, Set<ReadEntity> inputs, Set<WriteEntity> outputs, UserGroupInformation ugi) throws Exception { LogHelper console = SessionState.getConsole(); if (console == null) { return; } if (queryState != null) { console.printInfo("PREHOOK: query: " + queryState.getQueryString().trim(), false); console.printInfo("PREHOOK: type: " + queryState.getCommandType(), false); } printEntities(console, inputs, "PREHOOK: Input: "); printEntities(console, outputs, "PREHOOK: Output: "); }
protected SparkJobMonitor(HiveConf hiveConf) { monitorTimeoutInterval = hiveConf.getTimeVar(HiveConf.ConfVars.SPARK_JOB_MONITOR_TIMEOUT, TimeUnit.SECONDS); inPlaceUpdate = InPlaceUpdate.canRenderInPlace(hiveConf) && !SessionState.getConsole().getIsSilent(); console = new SessionState.LogHelper(LOG); updateFunction = updateFunction(); }
private RenderStrategy.UpdateFunction updateFunction() { return InPlaceUpdate.canRenderInPlace(hiveConf) && !SessionState.getConsole().getIsSilent() && !SessionState.get().isHiveServerQuery() ? new RenderStrategy.InPlaceUpdateFunction(this) : new RenderStrategy.LogToFileFunction(this); }
private RenderStrategy.UpdateFunction updateFunction() { return InPlaceUpdate.canRenderInPlace(hiveConf) && !SessionState.getConsole().getIsSilent() && !SessionState.get().isHiveServerQuery() ? new RenderStrategy.InPlaceUpdateFunction(this) : new RenderStrategy.LogToFileFunction(this); }