/** * Shutdown a Tez Session. * * @throws TezException * @throws IOException */ public synchronized void stop() throws TezException, IOException { LOG.info( "Shutting down Tez Session" + ", sessionName=" + sessionName + ", applicationId=" + applicationId); sessionStopped = true; try { DAGClientAMProtocolBlockingPB proxy = TezClientUtils.getSessionAMProxy( yarnClient, sessionConfig.getYarnConfiguration(), applicationId); if (proxy != null) { ShutdownSessionRequestProto request = ShutdownSessionRequestProto.newBuilder().build(); proxy.shutdownSession(null, request); return; } } catch (TezException e) { LOG.info("Failed to shutdown Tez Session via proxy", e); } catch (ServiceException e) { LOG.info("Failed to shutdown Tez Session via proxy", e); } LOG.info( "Could not connect to AM, killing session via YARN" + ", sessionName=" + sessionName + ", applicationId=" + applicationId); try { yarnClient.killApplication(applicationId); } catch (YarnException e) { throw new TezException(e); } }