Example usage for org.apache.hadoop.yarn.api.records.timeline TimelineDomain setReaders

List of usage examples for org.apache.hadoop.yarn.api.records.timeline TimelineDomain setReaders

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records.timeline TimelineDomain setReaders.

Prototype

public void setReaders(String readers) 

Source Link

Document

Set the reader (and/or reader group) list string

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  w  w.j  a v a2 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:io.hops.tensorflow.Client.java

License:Apache License

private void prepareTimelineDomain() {
    TimelineClient timelineClient;/*ww w.  j  a  va 2  s  .  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  ww .ja v  a  2s  .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);//w ww . j a  va  2s .  c o m

    ACLConfigurationParser parser = new ACLConfigurationParser(tezConf, false);
    timelineDomain.setReaders(getMergedViewACLs(parser, dagAccessControls));
    timelineDomain.setWriters(user);

    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);//w w w .ja v  a2s  .co m

    ACLConfigurationParser parser = new ACLConfigurationParser(tezConf, false);
    timelineDomain.setReaders(getMergedViewACLs(parser, dagAccessControls));
    timelineDomain.setWriters(user);

    // 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   ww  w  .  j a va2  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();
    }
}