当前位置: 首页>>代码示例>>Java>>正文


Java TimelineEvent.addEventInfo方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.api.records.timeline.TimelineEvent.addEventInfo方法的典型用法代码示例。如果您正苦于以下问题:Java TimelineEvent.addEventInfo方法的具体用法?Java TimelineEvent.addEventInfo怎么用?Java TimelineEvent.addEventInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.api.records.timeline.TimelineEvent的用法示例。


在下文中一共展示了TimelineEvent.addEventInfo方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateEntity

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
private static TimelineEntity generateEntity() {
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId("entity id");
  entity.setEntityType("entity type");
  entity.setStartTime(System.currentTimeMillis());
  for (int i = 0; i < 2; ++i) {
    TimelineEvent event = new TimelineEvent();
    event.setTimestamp(System.currentTimeMillis());
    event.setEventType("test event type " + i);
    event.addEventInfo("key1", "val1");
    event.addEventInfo("key2", "val2");
    entity.addEvent(event);
  }
  entity.addRelatedEntity("test ref type 1", "test ref id 1");
  entity.addRelatedEntity("test ref type 2", "test ref id 2");
  entity.addPrimaryFilter("pkey1", "pval1");
  entity.addPrimaryFilter("pkey2", "pval2");
  entity.addOtherInfo("okey1", "oval1");
  entity.addOtherInfo("okey2", "oval2");
  entity.setDomainId("domain id 1");
  return entity;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestTimelineClient.java

示例2: publishContainerEndEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
private static void publishContainerEndEvent(
    final TimelineClient timelineClient, ContainerStatus container,
    String domainId, UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(container.getContainerId().toString());
  entity.setEntityType(DSEntity.DS_CONTAINER.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter("user", ugi.getShortUserName());
  TimelineEvent event = new TimelineEvent();
  event.setTimestamp(System.currentTimeMillis());
  event.setEventType(DSEvent.DS_CONTAINER_END.toString());
  event.addEventInfo("State", container.getState().name());
  event.addEventInfo("Exit Status", container.getExitStatus());
  entity.addEvent(event);
  try {
    timelineClient.putEntities(entity);
  } catch (YarnException | IOException e) {
    LOG.error("Container end event could not be published for "
        + container.getContainerId().toString(), e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:ApplicationMaster.java

示例3: generateEntity

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
private static TimelineEntity generateEntity() {
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId("entity id");
  entity.setEntityType("entity type");
  entity.setStartTime(System.currentTimeMillis());
  for (int i = 0; i < 2; ++i) {
    TimelineEvent event = new TimelineEvent();
    event.setTimestamp(System.currentTimeMillis());
    event.setEventType("test event type " + i);
    event.addEventInfo("key1", "val1");
    event.addEventInfo("key2", "val2");
    entity.addEvent(event);
  }
  entity.addRelatedEntity("test ref type 1", "test ref id 1");
  entity.addRelatedEntity("test ref type 2", "test ref id 2");
  entity.addPrimaryFilter("pkey1", "pval1");
  entity.addPrimaryFilter("pkey2", "pval2");
  entity.addOtherInfo("okey1", "oval1");
  entity.addOtherInfo("okey2", "oval2");
  return entity;
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:22,代码来源:TestTimelineClient.java

示例4: publishContainerStartEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
private static void publishContainerStartEvent(TimelineClient timelineClient,
    Container container) throws IOException, YarnException {
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(container.getId().toString());
  entity.setEntityType(DSEntity.DS_CONTAINER.toString());
  entity.addPrimaryFilter("user", UserGroupInformation.getCurrentUser()
      .toString());
  TimelineEvent event = new TimelineEvent();
  event.setTimestamp(System.currentTimeMillis());
  event.setEventType(DSEvent.DS_CONTAINER_START.toString());
  event.addEventInfo("Node", container.getNodeId().toString());
  event.addEventInfo("Resources", container.getResource().toString());
  entity.addEvent(event);

  timelineClient.putEntities(entity);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:17,代码来源:ApplicationMaster.java

示例5: publishContainerEndEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
private static void publishContainerEndEvent(TimelineClient timelineClient,
    ContainerStatus container) throws IOException, YarnException {
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(container.getContainerId().toString());
  entity.setEntityType(DSEntity.DS_CONTAINER.toString());
  entity.addPrimaryFilter("user", UserGroupInformation.getCurrentUser()
      .toString());
  TimelineEvent event = new TimelineEvent();
  event.setTimestamp(System.currentTimeMillis());
  event.setEventType(DSEvent.DS_CONTAINER_END.toString());
  event.addEventInfo("State", container.getState().name());
  event.addEventInfo("Exit Status", container.getExitStatus());
  entity.addEvent(event);

  timelineClient.putEntities(entity);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:17,代码来源:ApplicationMaster.java

示例6: publishContainerStartEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
private static void publishContainerStartEvent(
    final TimelineClient timelineClient, Container container, String domainId,
    UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(container.getId().toString());
  entity.setEntityType(DSEntity.DS_CONTAINER.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter("user", ugi.getShortUserName());
  TimelineEvent event = new TimelineEvent();
  event.setTimestamp(System.currentTimeMillis());
  event.setEventType(DSEvent.DS_CONTAINER_START.toString());
  event.addEventInfo("Node", container.getNodeId().toString());
  event.addEventInfo("Resources", container.getResource().toString());
  entity.addEvent(event);

  try {
    ugi.doAs(new PrivilegedExceptionAction<TimelinePutResponse>() {
      @Override
      public TimelinePutResponse run() throws Exception {
        return timelineClient.putEntities(entity);
      }
    });
  } catch (Exception e) {
    LOG.error("Container start event could not be published for "
        + container.getId().toString(),
        e instanceof UndeclaredThrowableException ? e.getCause() : e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:ApplicationMaster.java

示例7: publishContainerEndEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
private static void publishContainerEndEvent(
    final TimelineClient timelineClient, ContainerStatus container,
    String domainId, UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(container.getContainerId().toString());
  entity.setEntityType(DSEntity.DS_CONTAINER.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter("user", ugi.getShortUserName());
  TimelineEvent event = new TimelineEvent();
  event.setTimestamp(System.currentTimeMillis());
  event.setEventType(DSEvent.DS_CONTAINER_END.toString());
  event.addEventInfo("State", container.getState().name());
  event.addEventInfo("Exit Status", container.getExitStatus());
  entity.addEvent(event);

  try {
    ugi.doAs(new PrivilegedExceptionAction<TimelinePutResponse>() {
      @Override
      public TimelinePutResponse run() throws Exception {
        return timelineClient.putEntities(entity);
      }
    });
  } catch (Exception e) {
    LOG.error("Container end event could not be published for "
        + container.getContainerId().toString(),
        e instanceof UndeclaredThrowableException ? e.getCause() : e);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:29,代码来源:ApplicationMaster.java

示例8: publishContainerStartEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
private void publishContainerStartEvent(
    final TimelineClient timelineClient, final Container container,
    String domainId, UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(container.getId().toString());
  entity.setEntityType(DSEntity.DS_CONTAINER.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter(USER_TIMELINE_FILTER_NAME, ugi.getShortUserName());
  entity.addPrimaryFilter(APPID_TIMELINE_FILTER_NAME, container.getId()
      .getApplicationAttemptId().getApplicationId().toString());
  TimelineEvent event = new TimelineEvent();
  event.setTimestamp(System.currentTimeMillis());
  event.setEventType(DSEvent.DS_CONTAINER_START.toString());
  event.addEventInfo("Node", container.getNodeId().toString());
  event.addEventInfo("Resources", container.getResource().toString());
  entity.addEvent(event);

  try {
    processTimelineResponseErrors(
        putContainerEntity(timelineClient,
            container.getId().getApplicationAttemptId(),
            entity));
  } catch (YarnException | IOException | ClientHandlerException e) {
    LOG.error("Container start event could not be published for "
        + container.getId().toString(), e);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:28,代码来源:ApplicationMaster.java

示例9: publishContainerEndEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
@VisibleForTesting
void publishContainerEndEvent(
    final TimelineClient timelineClient, ContainerStatus container,
    String domainId, UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(container.getContainerId().toString());
  entity.setEntityType(DSEntity.DS_CONTAINER.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter(USER_TIMELINE_FILTER_NAME, ugi.getShortUserName());
  entity.addPrimaryFilter(APPID_TIMELINE_FILTER_NAME,
      container.getContainerId().getApplicationAttemptId()
          .getApplicationId().toString());
  TimelineEvent event = new TimelineEvent();
  event.setTimestamp(System.currentTimeMillis());
  event.setEventType(DSEvent.DS_CONTAINER_END.toString());
  event.addEventInfo("State", container.getState().name());
  event.addEventInfo("Exit Status", container.getExitStatus());
  entity.addEvent(event);
  try {
    processTimelineResponseErrors(
        putContainerEntity(timelineClient,
            container.getContainerId().getApplicationAttemptId(),
            entity));
  } catch (YarnException | IOException | ClientHandlerException e) {
    LOG.error("Container end event could not be published for "
        + container.getContainerId().toString(), e);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:29,代码来源:ApplicationMaster.java

示例10: convertDAGRecoveredEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
private static TimelineEntity convertDAGRecoveredEvent(DAGRecoveredEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getDagID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_DAG_ID.name());

  TimelineEvent recoverEvt = new TimelineEvent();
  recoverEvt.setEventType(HistoryEventType.DAG_RECOVERED.name());
  recoverEvt.setTimestamp(event.getRecoveredTime());
  recoverEvt.addEventInfo(ATSConstants.APPLICATION_ATTEMPT_ID,
      event.getApplicationAttemptId().toString());
  if (event.getRecoveredDagState() != null) {
    recoverEvt.addEventInfo(ATSConstants.DAG_STATE, event.getRecoveredDagState().name());
  }
  if (event.getRecoveryFailureReason() != null) {
    recoverEvt.addEventInfo(ATSConstants.RECOVERY_FAILURE_REASON,
        event.getRecoveryFailureReason());
  }

  atsEntity.addEvent(recoverEvt);

  atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser());
  atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID,
      event.getApplicationAttemptId().getApplicationId().toString());
  atsEntity.addPrimaryFilter(ATSConstants.DAG_NAME, event.getDagName());
  atsEntity.addOtherInfo(ATSConstants.IN_PROGRESS_LOGS_URL + "_"
      + event.getApplicationAttemptId().getAttemptId(), event.getContainerLogs());

  return atsEntity;
}
 
开发者ID:apache,项目名称:tez,代码行数:30,代码来源:HistoryEventTimelineConversion.java

示例11: publishContainerStartEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
private static void publishContainerStartEvent(
        final TimelineClient timelineClient, Container container, String domainId,
        UserGroupInformation ugi) {
    final TimelineEntity entity = new TimelineEntity();
    entity.setEntityId(container.getId().toString());
    entity.setEntityType(DSEntity.DS_CONTAINER.toString());
    entity.setDomainId(domainId);
    entity.addPrimaryFilter(JOYConstants.USER, ugi.getShortUserName());
    TimelineEvent event = new TimelineEvent();
    event.setTimestamp(System.currentTimeMillis());
    event.setEventType(DSEvent.DS_CONTAINER_START.toString());
    event.addEventInfo(JOYConstants.NODE, container.getNodeId().toString());
    event.addEventInfo(JOYConstants.RESOURCES, container.getResource().toString());
    entity.addEvent(event);

    try {
        ugi.doAs(new PrivilegedExceptionAction<TimelinePutResponse>() {
            @Override
            public TimelinePutResponse run() throws Exception {
                return timelineClient.putEntities(entity);
            }
        });
    } catch (Exception e) {
        LOG.error("Container start event could not be published for "
                        + container.getId().toString(),
                e instanceof UndeclaredThrowableException ? e.getCause() : e);
    }
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:29,代码来源:JstormMaster.java

示例12: testEntities

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
@Test
public void testEntities() throws Exception {
  TimelineEntities entities = new TimelineEntities();
  for (int j = 0; j < 2; ++j) {
    TimelineEntity entity = new TimelineEntity();
    entity.setEntityId("entity id " + j);
    entity.setEntityType("entity type " + j);
    entity.setStartTime(System.currentTimeMillis());
    for (int i = 0; i < 2; ++i) {
      TimelineEvent event = new TimelineEvent();
      event.setTimestamp(System.currentTimeMillis());
      event.setEventType("event type " + i);
      event.addEventInfo("key1", "val1");
      event.addEventInfo("key2", "val2");
      entity.addEvent(event);
    }
    entity.addRelatedEntity("test ref type 1", "test ref id 1");
    entity.addRelatedEntity("test ref type 2", "test ref id 2");
    entity.addPrimaryFilter("pkey1", "pval1");
    entity.addPrimaryFilter("pkey2", "pval2");
    entity.addOtherInfo("okey1", "oval1");
    entity.addOtherInfo("okey2", "oval2");
    entities.addEntity(entity);
  }
  LOG.info("Entities in JSON:");
  LOG.info(TimelineUtils.dumpTimelineRecordtoJSON(entities, true));

  Assert.assertEquals(2, entities.getEntities().size());
  TimelineEntity entity1 = entities.getEntities().get(0);
  Assert.assertEquals("entity id 0", entity1.getEntityId());
  Assert.assertEquals("entity type 0", entity1.getEntityType());
  Assert.assertEquals(2, entity1.getRelatedEntities().size());
  Assert.assertEquals(2, entity1.getEvents().size());
  Assert.assertEquals(2, entity1.getPrimaryFilters().size());
  Assert.assertEquals(2, entity1.getOtherInfo().size());
  TimelineEntity entity2 = entities.getEntities().get(1);
  Assert.assertEquals("entity id 1", entity2.getEntityId());
  Assert.assertEquals("entity type 1", entity2.getEntityType());
  Assert.assertEquals(2, entity2.getRelatedEntities().size());
  Assert.assertEquals(2, entity2.getEvents().size());
  Assert.assertEquals(2, entity2.getPrimaryFilters().size());
  Assert.assertEquals(2, entity2.getOtherInfo().size());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:44,代码来源:TestTimelineRecords.java

示例13: testEvents

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入方法依赖的package包/类
@Test
public void testEvents() throws Exception {
  TimelineEvents events = new TimelineEvents();
  for (int j = 0; j < 2; ++j) {
    TimelineEvents.EventsOfOneEntity partEvents =
        new TimelineEvents.EventsOfOneEntity();
    partEvents.setEntityId("entity id " + j);
    partEvents.setEntityType("entity type " + j);
    for (int i = 0; i < 2; ++i) {
      TimelineEvent event = new TimelineEvent();
      event.setTimestamp(System.currentTimeMillis());
      event.setEventType("event type " + i);
      event.addEventInfo("key1", "val1");
      event.addEventInfo("key2", "val2");
      partEvents.addEvent(event);
    }
    events.addEvent(partEvents);
  }
  LOG.info("Events in JSON:");
  LOG.info(TimelineUtils.dumpTimelineRecordtoJSON(events, true));

  Assert.assertEquals(2, events.getAllEvents().size());
  TimelineEvents.EventsOfOneEntity partEvents1 = events.getAllEvents().get(0);
  Assert.assertEquals("entity id 0", partEvents1.getEntityId());
  Assert.assertEquals("entity type 0", partEvents1.getEntityType());
  Assert.assertEquals(2, partEvents1.getEvents().size());
  TimelineEvent event11 = partEvents1.getEvents().get(0);
  Assert.assertEquals("event type 0", event11.getEventType());
  Assert.assertEquals(2, event11.getEventInfo().size());
  TimelineEvent event12 = partEvents1.getEvents().get(1);
  Assert.assertEquals("event type 1", event12.getEventType());
  Assert.assertEquals(2, event12.getEventInfo().size());
  TimelineEvents.EventsOfOneEntity partEvents2 = events.getAllEvents().get(1);
  Assert.assertEquals("entity id 1", partEvents2.getEntityId());
  Assert.assertEquals("entity type 1", partEvents2.getEntityType());
  Assert.assertEquals(2, partEvents2.getEvents().size());
  TimelineEvent event21 = partEvents2.getEvents().get(0);
  Assert.assertEquals("event type 0", event21.getEventType());
  Assert.assertEquals(2, event21.getEventInfo().size());
  TimelineEvent event22 = partEvents2.getEvents().get(1);
  Assert.assertEquals("event type 1", event22.getEventType());
  Assert.assertEquals(2, event22.getEventInfo().size());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:44,代码来源:TestTimelineRecords.java


注:本文中的org.apache.hadoop.yarn.api.records.timeline.TimelineEvent.addEventInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。