Example usage for org.apache.hadoop.yarn.util.timeline TimelineUtils dumpTimelineRecordtoJSON

List of usage examples for org.apache.hadoop.yarn.util.timeline TimelineUtils dumpTimelineRecordtoJSON

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.util.timeline TimelineUtils dumpTimelineRecordtoJSON.

Prototype

public static String dumpTimelineRecordtoJSON(Object o)
        throws JsonGenerationException, JsonMappingException, IOException 

Source Link

Document

Serialize a POJO object into a JSON string not in a pretty format

Usage

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);//from  w  ww.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 {
        //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:io.hops.tensorflow.Client.java

License:Apache License

private void prepareTimelineDomain() {
    TimelineClient timelineClient;/* www  . java 2  s .co  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 ww.j a v  a 2 s  .c  o  m
        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:timo.yarn_app_call_java_daemon.Client.java

License:Apache License

/**
 * prepareTimelineDomain//w  w w .j a  va 2 s .  c om
 */
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();
    }
}