@Override public Void run() throws Exception { if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { // Creating the Timeline Client timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(conf); timelineClient.start(); } else { timelineClient = null; LOG.warn("Timeline service is not enabled"); } return null; } });
timelineClient.init(yarnConf); timelineClient.start();
private void prepareTimelineDomain() { TimelineClient timelineClient = null; if (jstormClientContext.conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(jstormClientContext.conf); timelineClient.start(); } else { LOG.warn("Cannot put the domain " + jstormClientContext.domainId + " because the timeline service is not enabled"); return; } try { TimelineDomain domain = new TimelineDomain(); domain.setId(jstormClientContext.domainId); domain.setReaders( jstormClientContext.viewACLs != null && jstormClientContext.viewACLs.length() > 0 ? jstormClientContext.viewACLs : JOYConstants.BLANK); domain.setWriters( jstormClientContext.modifyACLs != null && jstormClientContext.modifyACLs.length() > 0 ? jstormClientContext.modifyACLs : JOYConstants.BLANK); timelineClient.putDomain(domain); LOG.info("Put the timeline domain: " + TimelineUtils.dumpTimelineRecordtoJSON(domain)); } catch (Exception e) { LOG.error("Error when putting the timeline domain", e); } finally { timelineClient.stop(); } }
timelineClient.init(yarnConf); timelineClient.start();
@Override public Void run() throws Exception { if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { // Creating the Timeline Client timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(conf); timelineClient.start(); } else { timelineClient = null; LOG.warn("Timeline service is not enabled"); } return null; } });
private void prepareTimelineDomain() { TimelineClient timelineClient = null; if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(conf); timelineClient.start(); } else { LOG.warn("Cannot put the domain " + domainId + " because the timeline service is not enabled"); return; } try { TimelineDomain domain = new TimelineDomain(); domain.setId(domainId); domain.setReaders( viewACLs != null && viewACLs.length() > 0 ? viewACLs : " "); domain.setWriters( modifyACLs != null && modifyACLs.length() > 0 ? modifyACLs : " "); timelineClient.putDomain(domain); LOG.info("Put the timeline domain: " + TimelineUtils.dumpTimelineRecordtoJSON(domain)); } catch (Exception e) { LOG.error("Error when putting the timeline domain", e); } finally { timelineClient.stop(); } } }
private PigATSClient() { if (executor == null) { executor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ATS Logger %d").build()); YarnConfiguration yarnConf = new YarnConfiguration(); timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(yarnConf); timelineClient.start(); } Utils.addShutdownHookWithPriority(new Runnable() { @Override public void run() { timelineClient.stop(); executor.shutdownNow(); executor = null; } }, PigImplConstants.SHUTDOWN_HOOK_ATS_CLIENT_PRIORITY); log.info("Created ATS Hook"); }
private void initializeTimelineClient() { if (this.conf == null) { throw new TezUncheckedException("ATSACLManager not configured"); } if (timelineClient != null) { this.timelineClient.stop(); this.timelineClient = null; } if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { this.timelineClient = TimelineClient.createTimelineClient(); this.timelineClient.init(this.conf); this.timelineClient.start(); } else { this.timelineClient = null; if (conf.get(TezConfiguration.TEZ_HISTORY_LOGGING_SERVICE_CLASS, "") .equals(atsHistoryLoggingServiceClassName)) { LOG.warn(atsHistoryLoggingServiceClassName + " is disabled due to Timeline Service being disabled, " + YarnConfiguration.TIMELINE_SERVICE_ENABLED + " set to false"); } } try { this.user = UserGroupInformation.getCurrentUser().getShortUserName(); } catch (IOException e) { throw new TezUncheckedException("Unable to get Current User UGI", e); } }
@SuppressWarnings("unchecked") @Override public long renew(Token<?> token, Configuration conf) throws IOException, InterruptedException { TimelineClient client = TimelineClient.createTimelineClient(); try { client.init(conf); client.start(); return client.renewDelegationToken( (Token<TimelineDelegationTokenIdentifier>) token); } catch (YarnException e) { throw new IOException(e); } finally { client.stop(); } }
private void initializeTimelineClient() { if (this.conf == null) { throw new TezUncheckedException("ATSACLManager not configured"); } if (timelineClient != null) { this.timelineClient.stop(); this.timelineClient = null; } if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { this.timelineClient = TimelineClient.createTimelineClient(); this.timelineClient.init(this.conf); this.timelineClient.start(); } else { this.timelineClient = null; if (conf.get(TezConfiguration.TEZ_HISTORY_LOGGING_SERVICE_CLASS, "") .equals(atsHistoryLoggingServiceClassName)) { LOG.warn(atsHistoryLoggingServiceClassName + " is disabled due to Timeline Service being disabled, " + YarnConfiguration.TIMELINE_SERVICE_ENABLED + " set to false"); } } try { this.user = UserGroupInformation.getCurrentUser().getShortUserName(); } catch (IOException e) { throw new TezUncheckedException("Unable to get Current User UGI", e); } }
@SuppressWarnings("unchecked") @Override public long renew(Token<?> token, Configuration conf) throws IOException, InterruptedException { TimelineClient client = TimelineClient.createTimelineClient(); try { client.init(conf); client.start(); return client.renewDelegationToken( (Token<TimelineDelegationTokenIdentifier>) token); } catch (YarnException e) { throw new IOException(e); } finally { client.stop(); } }
@SuppressWarnings("unchecked") @Override public long renew(Token<?> token, Configuration conf) throws IOException, InterruptedException { TimelineClient client = TimelineClient.createTimelineClient(); try { client.init(conf); client.start(); return client.renewDelegationToken( (Token<TimelineDelegationTokenIdentifier>) token); } catch (YarnException e) { throw new IOException(e); } finally { client.stop(); } }
@SuppressWarnings("unchecked") @Override public void cancel(Token<?> token, Configuration conf) throws IOException, InterruptedException { TimelineClient client = TimelineClient.createTimelineClient(); try { client.init(conf); client.start(); client.cancelDelegationToken( (Token<TimelineDelegationTokenIdentifier>) token); } catch (YarnException e) { throw new IOException(e); } finally { client.stop(); } } }
@SuppressWarnings("unchecked") @Override public void cancel(Token<?> token, Configuration conf) throws IOException, InterruptedException { TimelineClient client = TimelineClient.createTimelineClient(); try { client.init(conf); client.start(); client.cancelDelegationToken( (Token<TimelineDelegationTokenIdentifier>) token); } catch (YarnException e) { throw new IOException(e); } finally { client.stop(); } } }
@SuppressWarnings("unchecked") @Override public void cancel(Token<?> token, Configuration conf) throws IOException, InterruptedException { TimelineClient client = TimelineClient.createTimelineClient(); try { client.init(conf); client.start(); client.cancelDelegationToken( (Token<TimelineDelegationTokenIdentifier>) token); } catch (YarnException e) { throw new IOException(e); } finally { client.stop(); } } }
public static Token<TimelineDelegationTokenIdentifier> maybeAddTimelineToken( Configuration conf, Credentials credentials) throws IOException, YarnException { if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)) { LOG.debug("Timeline service enabled -fetching token"); try(TimelineClient timelineClient = TimelineClient.createTimelineClient()) { timelineClient.init(conf); timelineClient.start(); Token<TimelineDelegationTokenIdentifier> token = timelineClient.getDelegationToken( CredentialUtils.getRMPrincipal(conf)); credentials.addToken(token.getService(), token); return token; } } else { LOG.debug("Timeline service is disabled"); return null; } }
public static Token<TimelineDelegationTokenIdentifier> maybeAddTimelineToken( Configuration conf, Credentials credentials) throws IOException, YarnException { if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)) { LOG.debug("Timeline service enabled -fetching token"); try(TimelineClient timelineClient = TimelineClient.createTimelineClient()) { timelineClient.init(conf); timelineClient.start(); Token<TimelineDelegationTokenIdentifier> token = timelineClient.getDelegationToken( CredentialUtils.getRMPrincipal(conf)); credentials.addToken(token.getService(), token); return token; } } else { LOG.debug("Timeline service is disabled"); return null; } }
private TimelineClient createTimelineClientForUGI() { TimelineClient client = TimelineClient.createTimelineClient(); client.init(conf); client.start(); return client; }
public ATSHook() { synchronized(LOCK) { if (executor == null) { executor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ATS Logger %d").build()); YarnConfiguration yarnConf = new YarnConfiguration(); timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(yarnConf); timelineClient.start(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { executor.shutdown(); executor.awaitTermination(WAIT_TIME, TimeUnit.SECONDS); executor = null; } catch(InterruptedException ie) { /* ignore */ } timelineClient.stop(); } }); } } LOG.info("Created ATS Hook"); }
@Override public Void run() throws Exception { if (YarnConfiguration.timelineServiceEnabled(conf)) { timelineServiceV1Enabled = YarnConfiguration.timelineServiceV1Enabled(conf); timelineServiceV2Enabled = YarnConfiguration.timelineServiceV2Enabled(conf); // Creating the Timeline Client if (timelineServiceV1Enabled) { timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(conf); timelineClient.start(); LOG.info("Timeline service V1 client is enabled"); } if (timelineServiceV2Enabled) { timelineV2Client = TimelineV2Client.createTimelineClient( appAttemptID.getApplicationId()); timelineV2Client.init(conf); timelineV2Client.start(); LOG.info("Timeline service V2 client is enabled"); } } else { timelineClient = null; timelineV2Client = null; LOG.warn("Timeline service is not enabled"); } return null; } });