Example usage for org.apache.hadoop.yarn.api.records.timeline TimelineEvent setEventInfo

List of usage examples for org.apache.hadoop.yarn.api.records.timeline TimelineEvent setEventInfo

Introduction

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

Prototype

public void setEventInfo(Map<String, Object> eventInfo) 

Source Link

Document

Set the information map to the given map of the information of the event

Usage

From source file:org.apache.tez.dag.history.logging.ats.HistoryEventTimelineConversion.java

License:Apache License

private static TimelineEntity convertVertexParallelismUpdatedEvent(VertexParallelismUpdatedEvent event) {
    TimelineEntity atsEntity = new TimelineEntity();
    atsEntity.setEntityId(event.getVertexID().toString());
    atsEntity.setEntityType(EntityTypes.TEZ_VERTEX_ID.name());

    atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID,
            event.getVertexID().getDAGId().getApplicationId().toString());
    atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(), event.getVertexID().getDAGId().toString());

    TimelineEvent updateEvt = new TimelineEvent();
    updateEvt.setEventType(HistoryEventType.VERTEX_PARALLELISM_UPDATED.name());
    updateEvt.setTimestamp(event.getUpdateTime());

    Map<String, Object> eventInfo = new HashMap<String, Object>();
    if (event.getSourceEdgeManagers() != null && !event.getSourceEdgeManagers().isEmpty()) {
        Map<String, Object> updatedEdgeManagers = new HashMap<String, Object>();
        for (Entry<String, EdgeManagerPluginDescriptor> entry : event.getSourceEdgeManagers().entrySet()) {
            updatedEdgeManagers.put(entry.getKey(),
                    DAGUtils.convertEdgeManagerPluginDescriptor(entry.getValue()));
        }/*from ww w . j a  v  a  2s  . c  o  m*/
        eventInfo.put(ATSConstants.UPDATED_EDGE_MANAGERS, updatedEdgeManagers);
    }
    eventInfo.put(ATSConstants.NUM_TASKS, event.getNumTasks());
    eventInfo.put(ATSConstants.OLD_NUM_TASKS, event.getOldNumTasks());
    updateEvt.setEventInfo(eventInfo);
    atsEntity.addEvent(updateEvt);

    atsEntity.addOtherInfo(ATSConstants.NUM_TASKS, event.getNumTasks());

    return atsEntity;
}