Example usage for org.apache.hadoop.yarn.api.records.timeline TimelineEntity getDomainId

List of usage examples for org.apache.hadoop.yarn.api.records.timeline TimelineEntity getDomainId

Introduction

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

Prototype

@XmlElement(name = "domain")
public String getDomainId() 

Source Link

Document

Get the ID of the domain that the entity is to be put

Usage

From source file:org.apache.tez.dag.history.ats.acls.TestATSHistoryWithACLs.java

License:Apache License

private void verifyEntityDomains(ApplicationId applicationId, boolean sameDomain) {
    assertNotNull(timelineAddress);/*w ww .  ja  va 2s . com*/

    String appUrl = "http://" + timelineAddress + "/ws/v1/timeline/TEZ_APPLICATION/" + "tez_"
            + applicationId.toString();
    LOG.info("Getting timeline entity for tez application: " + appUrl);
    TimelineEntity appEntity = getTimelineData(appUrl, TimelineEntity.class);

    TezDAGID tezDAGID = TezDAGID.getInstance(applicationId, 1);
    String dagUrl = "http://" + timelineAddress + "/ws/v1/timeline/TEZ_DAG_ID/" + tezDAGID.toString();
    LOG.info("Getting timeline entity for tez dag: " + dagUrl);
    TimelineEntity dagEntity = getTimelineData(dagUrl, TimelineEntity.class);

    // App and DAG entities should have different domains
    assertEquals(ATSHistoryACLPolicyManager.DOMAIN_ID_PREFIX + applicationId.toString(),
            appEntity.getDomainId());
    if (!sameDomain) {
        assertEquals(
                ATSHistoryACLPolicyManager.DOMAIN_ID_PREFIX + applicationId.toString() + "_TezSleepProcessor",
                dagEntity.getDomainId());
    } else {
        assertEquals(appEntity.getDomainId(), dagEntity.getDomainId());
    }
}

From source file:org.Microsoft.Telemetry.ServiceInformation.java

private void putToLog(TimelineEntity entity) throws Exception {

    try {//from  w w w.  java 2s. c o  m

        WriteToFileLog("Entity Type  :", entity.getEntityType());

        WriteToFileLog("Entity ID  :", entity.getEntityId());

        WriteToFileLog("Domain ID  :", entity.getDomainId());

        if (entity.getStartTime() != null) {
            WriteToFileLog("Start Time :", CastFromTimeToStringFormat(entity.getStartTime()));
        }

        // print all events of Entity
        WriteToFileLog("\tprint all events   ", "");

        LOG.info(PATTERN_LOG_INFO + " print all events of Entity Name :" + String.format(
                "Entity ID :%s , Entity Type : %s )\n\n", entity.getEntityId(), entity.getEntityType()));

        if (entity.getEvents() != null) {
            List<TimelineEvent> events = entity.getEvents();

            WriteToFileLog("Start List of events of  ( ", String.format(
                    "Entity ID :%s , Entity Type : %s )\n\n", entity.getEntityId(), entity.getEntityType()));

            for (TimelineEvent event : events) {

                WriteToFileLog("\tEvent Type  :", event.getEventType() + ",");
                WriteToFileLog("\tTime Stamp  :", CastFromTimeToStringFormat(event.getTimestamp()) + ",");

                if (event.getEventInfo() != null) {
                    WriteToFileLog("\tprint all Event Info  ", "");
                    // Get an iterator
                    Set set = event.getEventInfo().entrySet();

                    Iterator iter = set.iterator();

                    if (set.size() > 0) {
                        WriteToFileLog("\t\tStart List Event Info  ", "");
                    }

                    while (iter.hasNext()) {
                        // Display elements
                        Map.Entry me = (Map.Entry) iter.next();

                        //sed information to history file
                        WriteObjectToLog("\t\t { Key : " + me.getKey() + ", Value: ", me.getValue());

                    }
                    if (set.size() > 0) {
                        WriteToFileLog("\n\t\tEnd List Event Info  ", "");
                    }
                }

            }
            WriteToFileLog("End List of events of  :", entity.getEntityType() + "\n\n");
        } else {
            LOG.info(PATTERN_LOG_INFO + "variable  events of entity is null ");
        }

        // print all Related Entities of Entity
        WriteToFileLog("\tprint all Related Entities   ", "");
        LOG.info(PATTERN_LOG_INFO + "print all Related Entities of Entity Name :" + String.format(
                "Entity ID :%s , Entity Type : %s )\n\n", entity.getEntityId(), entity.getEntityType()));
        if (entity.getRelatedEntities() != null) {
            //Map<String, Set<String>> RelatedEntities = entity.getRelatedEntities();

            WriteToFileLog("Start List of Related Entities of  ( ", String.format(
                    "Entity ID :%s , Entity Type : %s )\n\n", entity.getEntityId(), entity.getEntityType()));

            Set set = entity.getRelatedEntities().entrySet();

            Iterator iter = set.iterator();

            if (set.size() > 0) {
                WriteToFileLog("\t\tStart List Related Entities  ", "");
            }
            while (iter.hasNext()) {
                // Display elements
                Map.Entry me = (Map.Entry) iter.next();

                //send information to history file
                Set<String> setcoll = (Set<String>) me.getValue();

                if (setcoll.size() > 0) {
                    WriteToFileLog("\t\t { Key: (" + me.getKey() + " )  ", "\n\t\t\t[");
                } else {
                    WriteToFileLog("\t\t { Key: (" + me.getKey() + " )  ", "\n\t\t\t Empty Value");
                }
                //over all parts of set<string>
                for (String str : setcoll) {
                    WriteToFileLog("\t\t\t", str + ",");
                }
                WriteToFileLog("\n\t\t\t]", "\n}");

            }
            if (set.size() > 0) {
                WriteToFileLog("\t\tEnd List Related Entities  ", "");
            }
            WriteToFileLog("\t\t}", "");
            WriteToFileLog("End List of Related Entities  of  :", entity.getEntityType() + "\n\n");

        } else {
            LOG.info(PATTERN_LOG_INFO + "variable  Related Entities is null ");
        }

        // print all Primary Filters of Entity
        WriteToFileLog("\tprint all Primary Filters   ", "");
        LOG.info(PATTERN_LOG_INFO + "print all Primary Filters of Entity Name :" + String.format(
                "Entity ID :%s , Entity Type : %s )\n\n", entity.getEntityId(), entity.getEntityType()));

        if (entity.getPrimaryFilters() != null) {
            //Map<String, Set<Object>> PrimaryFilters = entity.getRelatedEntities();

            WriteToFileLog("Start List of Primary Filters of  ( ", String.format(
                    "Entity ID :%s , Entity Type : %s )\n\n", entity.getEntityId(), entity.getEntityType()));

            Set set = entity.getPrimaryFilters().entrySet();

            Iterator iter = set.iterator();

            if (set.size() > 0) {
                WriteToFileLog("\t\tStart List Primary Filters   ", "");
            }
            while (iter.hasNext()) {
                // Display elements
                Map.Entry me = (Map.Entry) iter.next();

                //sed information to history file
                Set<Object> setcoll = (Set<Object>) me.getValue();

                if (setcoll.size() > 0) {
                    WriteToFileLog("\t\t { Key: (" + me.getKey() + " )  ", "\n\t\t\t[");
                } else {
                    WriteToFileLog("\t\t { Key: (" + me.getKey() + " )  ", "\n\t\t\t Empty Value");
                }
                //over all parts of set<Object>
                for (Object obj : setcoll) {
                    WriteObjectToLog("", obj);
                }
                WriteToFileLog("\n\t\t\t]", "\n}");

            }
            if (set.size() > 0) {
                WriteToFileLog("\t\tEnd List Related Entities  ", "");
            }
            WriteToFileLog("\t\t}", "");
            WriteToFileLog("End List of Primary Filters  of  :", entity.getEntityType() + "\n\n");

        } else {
            LOG.info(PATTERN_LOG_INFO + "variable  Primary Filters is null ");
        }

        // print all Other Info of Entity
        WriteToFileLog("\tprint all Other Info   ", "");
        LOG.info(PATTERN_LOG_INFO + "print all Other Info of Entity Name :" + String.format(
                "Entity ID :%s , Entity Type : %s )\n\n", entity.getEntityId(), entity.getEntityType()));

        if (entity.getOtherInfo() != null) {
            // Map<String,Object> OtherInfo = entity.getOtherInfo();

            Set set = entity.getOtherInfo().entrySet();

            if (set.size() > 0) {
                WriteToFileLog("Start List of Other Info of  ( ",
                        String.format("Entity ID :%s , Entity Type : %s )\n\n", entity.getEntityId(),
                                entity.getEntityType()));
            }
            Iterator iter = set.iterator();

            while (iter.hasNext()) {
                // Display elements
                Map.Entry me = (Map.Entry) iter.next();

                //sed information to history file
                WriteObjectToLog("\t Key : " + me.getKey() + "   : Value : ", me.getValue());
            }
            if (set.size() > 0) {
                WriteToFileLog("\nEnd List of Other Info  of  :", entity.getEntityType() + "\n\n");
            }

        } else {
            LOG.info(PATTERN_LOG_INFO + "variable  Other Info is null ");
        }

        LOG.info(PATTERN_LOG_INFO + "Finished to print all information of Entity Name :" + String.format(
                "Entity ID :%s , Entity Type : %s )\n\n\n\n", entity.getEntityId(), entity.getEntityType()));

    } catch (Exception e) {

        String message = PATTERN_LOG_ERROR + "Creating a problem while writing the history  file";
        LOG.error(message, e);

        throw e;
    } finally {

    }
}