List of usage examples for org.apache.hadoop.yarn.api.records.timeline TimelineDomain setId
public void setId(String id)
From source file:com.inforefiner.hdata.SubmitClient.java
License:Apache License
private void prepareTimelineDomain() { TimelineClient timelineClient = null; if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(conf);//w ww .j ava 2 s . c o m timelineClient.start(); } else { LOG.warn("Cannot put the domain " + domainId + " because the timeline service is not enabled"); return; } try { //TODO: we need to check and combine the existing timeline domain ACLs, //but let's do it once we have client java library to query domains. 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(); } }
From source file:de.huberlin.wbi.hiway.am.WorkflowDriver.java
License:Apache License
private void timelineWrite(String entity, String message) { if (timelineClient == null) return;//from w w w. jav a 2 s.c om try { TimelineDomain myDomain = new TimelineDomain(); myDomain.setId("hiwayWorkflow"); timelineClient.putDomain(myDomain); TimelineEntity myEntity = new TimelineEntity(); myEntity.setDomainId(myDomain.getId()); myEntity.setEntityType("APPLICATION"); myEntity.setEntityId(entity); TimelinePutResponse response = timelineClient.putEntities(myEntity); if (response.getErrors().size() > 0) Logger.writeToStdErr(String.format("Errors in timelineWrite for putting entity %s: %s", entity, response.getErrors().stream().map(Object::toString).collect(Collectors.joining("; ")))); TimelineEvent event = new TimelineEvent(); event.setEventType("LOG"); event.setTimestamp(System.currentTimeMillis()); event.addEventInfo("MESSAGE", message); myEntity.addEvent(event); response = timelineClient.putEntities(myEntity); if (response.getErrors().size() > 0) Logger.writeToStdErr(String.format("Errors in timelineWrite for putting event %s: %s", message, response.getErrors().stream().map(Object::toString).collect(Collectors.joining("; ")))); } catch (IOException e) { // Handle the exception } catch (RuntimeException e) { // In Hadoop 2.6, if attempts submit information to the Timeline Server fail more than the retry limit, // a RuntimeException will be raised. This may change in future releases, being // replaced with a IOException that is (or wraps) that which triggered retry failures. } catch (YarnException e) { // Handle the exception } }
From source file:io.hops.tensorflow.Client.java
License:Apache License
private void prepareTimelineDomain() { TimelineClient timelineClient;//from w w w. j a v a2s. c o m 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(); } }
From source file:org.apache.metron.maas.service.Client.java
License:Apache License
private void prepareTimelineDomain() { TimelineClient timelineClient = null; if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) { timelineClient = TimelineClient.createTimelineClient(); timelineClient.init(conf);/*from w w w . jav a 2 s .c om*/ 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(); } }
From source file:org.apache.tez.dag.history.ats.acls.ATSHistoryACLPolicyManager.java
License:Apache License
private void createTimelineDomain(String domainId, Configuration tezConf, DAGAccessControls dagAccessControls) throws IOException { TimelineDomain timelineDomain = new TimelineDomain(); timelineDomain.setId(domainId); ACLConfigurationParser parser = new ACLConfigurationParser(tezConf, false); timelineDomain.setReaders(getMergedViewACLs(parser, dagAccessControls)); timelineDomain.setWriters(user);/*from w w w .ja v a 2s . c om*/ try { timelineClient.putDomain(timelineDomain); } catch (Exception e) { LOG.warn("Could not post timeline domain", e); } }
From source file:org.apache.tez.dag.history.ats.acls.ATSV15HistoryACLPolicyManager.java
License:Apache License
private void createTimelineDomain(ApplicationId applicationId, String domainId, Configuration tezConf, DAGAccessControls dagAccessControls) throws IOException, HistoryACLPolicyException { TimelineDomain timelineDomain = new TimelineDomain(); timelineDomain.setId(domainId); ACLConfigurationParser parser = new ACLConfigurationParser(tezConf, false); timelineDomain.setReaders(getMergedViewACLs(parser, dagAccessControls)); timelineDomain.setWriters(user);//from ww w .j av a 2s .com // Use dummy app attempt id ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(applicationId, 1); try { if (timelineClient != null) { timelineClient.putDomain(appAttemptId, timelineDomain); } } catch (Exception e) { LOG.warn("Could not post timeline domain", e); throw new HistoryACLPolicyException("Fail to create ACL-related domain in Timeline", e); } }
From source file:timo.yarn_app_call_java_daemon.Client.java
License:Apache License
/** * prepareTimelineDomain//from w w w .ja v a 2 s .c o m */ 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(); } }