• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TimelineEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



TimelineEvent类属于org.apache.hadoop.yarn.api.records.timeline包,在下文中一共展示了TimelineEvent类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: publishApplicationCreatedEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
private void publishApplicationCreatedEvent(ApplicationCreatedEvent event) {
  TimelineEntity entity =
      createApplicationEntity(event.getApplicationId());
  Map<String, Object> entityInfo = new HashMap<String, Object>();
  entityInfo.put(ApplicationMetricsConstants.NAME_ENTITY_INFO,
      event.getApplicationName());
  entityInfo.put(ApplicationMetricsConstants.TYPE_ENTITY_INFO,
      event.getApplicationType());
  entityInfo.put(ApplicationMetricsConstants.USER_ENTITY_INFO,
      event.getUser());
  entityInfo.put(ApplicationMetricsConstants.QUEUE_ENTITY_INFO,
      event.getQueue());
  entityInfo.put(ApplicationMetricsConstants.SUBMITTED_TIME_ENTITY_INFO,
      event.getSubmittedTime());
  entity.setOtherInfo(entityInfo);
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(
      ApplicationMetricsConstants.CREATED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:SystemMetricsPublisher.java


示例3: publishAppAttemptRegisteredEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
private void
    publishAppAttemptRegisteredEvent(AppAttemptRegisteredEvent event) {
  TimelineEntity entity =
      createAppAttemptEntity(event.getApplicationAttemptId());
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(
      AppAttemptMetricsConstants.REGISTERED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  Map<String, Object> eventInfo = new HashMap<String, Object>();
  eventInfo.put(
      AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO,
      event.getTrackingUrl());
  eventInfo.put(
      AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO,
      event.getOriginalTrackingURL());
  eventInfo.put(AppAttemptMetricsConstants.HOST_EVENT_INFO,
      event.getHost());
  eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO,
      event.getRpcPort());
  eventInfo.put(
      AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
      event.getMasterContainerId().toString());
  tEvent.setEventInfo(eventInfo);
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:SystemMetricsPublisher.java


示例4: publishAppAttemptFinishedEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
private void publishAppAttemptFinishedEvent(AppAttemptFinishedEvent event) {
  TimelineEntity entity =
      createAppAttemptEntity(event.getApplicationAttemptId());
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(AppAttemptMetricsConstants.FINISHED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  Map<String, Object> eventInfo = new HashMap<String, Object>();
  eventInfo.put(
      AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO,
      event.getTrackingUrl());
  eventInfo.put(
      AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO,
      event.getOriginalTrackingURL());
  eventInfo.put(AppAttemptMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO,
      event.getDiagnosticsInfo());
  eventInfo.put(AppAttemptMetricsConstants.FINAL_STATUS_EVENT_INFO,
      event.getFinalApplicationStatus().toString());
  eventInfo.put(AppAttemptMetricsConstants.STATE_EVENT_INFO,
      event.getYarnApplicationAttemptState().toString());
  tEvent.setEventInfo(eventInfo);
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:SystemMetricsPublisher.java


示例5: publishContainerCreatedEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
private void publishContainerCreatedEvent(ContainerCreatedEvent event) {
  TimelineEntity entity = createContainerEntity(event.getContainerId());
  Map<String, Object> entityInfo = new HashMap<String, Object>();
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO,
      event.getAllocatedResource().getMemory());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO,
      event.getAllocatedResource().getVirtualCores());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_GCORE_ENTITY_INFO,
      event.getAllocatedResource().getGpuCores());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO,
      event.getAllocatedNode().getHost());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO,
      event.getAllocatedNode().getPort());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO,
      event.getAllocatedPriority().getPriority());
  entityInfo.put(
    ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_ENTITY_INFO,
    event.getNodeHttpAddress());
  entity.setOtherInfo(entityInfo);
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(ContainerMetricsConstants.CREATED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:SystemMetricsPublisher.java


示例6: publishContainerFinishedEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
private void publishContainerFinishedEvent(ContainerFinishedEvent event) {
  TimelineEntity entity = createContainerEntity(event.getContainerId());
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(ContainerMetricsConstants.FINISHED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  Map<String, Object> eventInfo = new HashMap<String, Object>();
  eventInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO,
      event.getDiagnosticsInfo());
  eventInfo.put(ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO,
      event.getContainerExitStatus());
  eventInfo.put(ContainerMetricsConstants.STATE_EVENT_INFO,
      event.getContainerState().toString());
  tEvent.setEventInfo(eventInfo);
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:SystemMetricsPublisher.java


示例7: testGetEvents

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
@Test
public void testGetEvents() throws Exception {
  WebResource r = resource();
  ClientResponse response = r.path("ws").path("v1").path("timeline")
      .path("type_1").path("events")
      .queryParam("entityId", "id_1")
      .accept(MediaType.APPLICATION_JSON)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  TimelineEvents events = response.getEntity(TimelineEvents.class);
  Assert.assertNotNull(events);
  Assert.assertEquals(1, events.getAllEvents().size());
  TimelineEvents.EventsOfOneEntity partEvents = events.getAllEvents().get(0);
  Assert.assertEquals(2, partEvents.getEvents().size());
  TimelineEvent event1 = partEvents.getEvents().get(0);
  Assert.assertEquals(456l, event1.getTimestamp());
  Assert.assertEquals("end_event", event1.getEventType());
  Assert.assertEquals(1, event1.getEventInfo().size());
  TimelineEvent event2 = partEvents.getEvents().get(1);
  Assert.assertEquals(123l, event2.getTimestamp());
  Assert.assertEquals("start_event", event2.getEventType());
  Assert.assertEquals(0, event2.getEventInfo().size());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestTimelineWebServices.java


示例8: createEntity

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
/**
 * Create a test entity
 */
protected static TimelineEntity createEntity(String entityId, String entityType,
    Long startTime, List<TimelineEvent> events,
    Map<String, Set<String>> relatedEntities,
    Map<String, Set<Object>> primaryFilters,
    Map<String, Object> otherInfo, String domainId) {
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(entityId);
  entity.setEntityType(entityType);
  entity.setStartTime(startTime);
  entity.setEvents(events);
  if (relatedEntities != null) {
    for (Entry<String, Set<String>> e : relatedEntities.entrySet()) {
      for (String v : e.getValue()) {
        entity.addRelatedEntity(e.getKey(), v);
      }
    }
  } else {
    entity.setRelatedEntities(null);
  }
  entity.setPrimaryFilters(primaryFilters);
  entity.setOtherInfo(otherInfo);
  entity.setDomainId(domainId);
  return entity;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:TimelineStoreTestUtils.java


示例9: 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


示例10: publishApplicationAttemptEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
private static void publishApplicationAttemptEvent(
    final TimelineClient timelineClient, String appAttemptId,
    DSEvent appEvent, String domainId, UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(appAttemptId);
  entity.setEntityType(DSEntity.DS_APP_ATTEMPT.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter("user", ugi.getShortUserName());
  TimelineEvent event = new TimelineEvent();
  event.setEventType(appEvent.toString());
  event.setTimestamp(System.currentTimeMillis());
  entity.addEvent(event);
  try {
    timelineClient.putEntities(entity);
  } catch (YarnException | IOException e) {
    LOG.error("App Attempt "
        + (appEvent.equals(DSEvent.DS_APP_ATTEMPT_START) ? "start" : "end")
        + " event could not be published for "
        + appAttemptId.toString(), e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:ApplicationMaster.java


示例11: publishContainerCreatedEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
private void publishContainerCreatedEvent(ContainerCreatedEvent event) {
  TimelineEntity entity = createContainerEntity(event.getContainerId());
  Map<String, Object> entityInfo = new HashMap<String, Object>();
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO,
      event.getAllocatedResource().getMemory());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO,
      event.getAllocatedResource().getVirtualCores());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO,
      event.getAllocatedNode().getHost());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO,
      event.getAllocatedNode().getPort());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO,
      event.getAllocatedPriority().getPriority());
  entityInfo.put(
    ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_ENTITY_INFO,
    event.getNodeHttpAddress());
  entity.setOtherInfo(entityInfo);
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(ContainerMetricsConstants.CREATED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:SystemMetricsPublisher.java


示例12: getAndSetStartTime

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
/**
 * Get the unique start time for a given entity as a byte array that sorts the
 * timestamps in reverse order (see
 * {@link GenericObjectMapper#writeReverseOrderedLong(long)}). If the start
 * time doesn't exist, set it based on the information provided. Should only
 * be called when a lock has been obtained on the entity.
 *
 * @param entityId
 *          The id of the entity
 * @param entityType
 *          The type of the entity
 * @param startTime
 *          The start time of the entity, or null
 * @param events
 *          A list of events for the entity, or null
 * @return A StartAndInsertTime
 * @throws IOException
 */
private Long getAndSetStartTime(String entityId, String entityType,
    Long startTime, List<TimelineEvent> events) throws IOException {
  EntityIdentifier entity = new EntityIdentifier(entityId, entityType);
  Long time = startTimeWriteCache.get(entity);
  if (time != null) {
    // return the value in the cache
    return time;
  }
  if (startTime == null && events != null) {
    // calculate best guess start time based on lowest event time
    startTime = Long.MAX_VALUE;
    for (TimelineEvent e : events) {
      if (e.getTimestamp() < startTime) {
        startTime = e.getTimestamp();
      }
    }
  }
  // check the provided start time matches the db
  return checkStartTimeInDb(entity, startTime);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:39,代码来源:RollingLevelDBTimelineStore.java


示例13: getEntityEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
/**
 * Creates an event object from the given key, offset, and value. If the event
 * type is not contained in the specified set of event types, returns null.
 */
private static TimelineEvent getEntityEvent(Set<String> eventTypes,
    byte[] key, int offset, byte[] value) throws IOException {
  KeyParser kp = new KeyParser(key, offset);
  long ts = kp.getNextLong();
  String tstype = kp.getNextString();
  if (eventTypes == null || eventTypes.contains(tstype)) {
    TimelineEvent event = new TimelineEvent();
    event.setTimestamp(ts);
    event.setEventType(tstype);
    Object o = fstConf.asObject(value);
    if (o == null) {
      event.setEventInfo(null);
    } else if (o instanceof Map) {
      @SuppressWarnings("unchecked")
      Map<String, Object> m = (Map<String, Object>) o;
      event.setEventInfo(m);
    } else {
      throw new IOException("Couldn't deserialize event info map");
    }
    return event;
  }
  return null;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:28,代码来源:RollingLevelDBTimelineStore.java


示例14: publishApplicationFinishedEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
private void publishApplicationFinishedEvent(ApplicationFinishedEvent event) {
  TimelineEntity entity =
      createApplicationEntity(event.getApplicationId());
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(
      ApplicationMetricsConstants.FINISHED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  Map<String, Object> eventInfo = new HashMap<String, Object>();
  eventInfo.put(ApplicationMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO,
      event.getDiagnosticsInfo());
  eventInfo.put(ApplicationMetricsConstants.FINAL_STATUS_EVENT_INFO,
      event.getFinalApplicationStatus().toString());
  eventInfo.put(ApplicationMetricsConstants.STATE_EVENT_INFO,
      event.getYarnApplicationState().toString());
  if (event.getLatestApplicationAttemptId() != null) {
    eventInfo.put(ApplicationMetricsConstants.LATEST_APP_ATTEMPT_EVENT_INFO,
        event.getLatestApplicationAttemptId().toString());
  }
  tEvent.setEventInfo(eventInfo);
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:23,代码来源:SystemMetricsPublisher.java


示例15: publishContainerCreatedEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
private void publishContainerCreatedEvent(ContainerCreatedEvent event) {
  TimelineEntity entity = createContainerEntity(event.getContainerId());
  Map<String, Object> entityInfo = new HashMap<String, Object>();
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO,
      event.getAllocatedResource().getMemory());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO,
      event.getAllocatedResource().getVirtualCores());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO,
      event.getAllocatedNode().getHost());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO,
      event.getAllocatedNode().getPort());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO,
      event.getAllocatedPriority().getPriority());
  entity.setOtherInfo(entityInfo);
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(ContainerMetricsConstants.CREATED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:21,代码来源:SystemMetricsPublisher.java


示例16: getEntityEvent

import org.apache.hadoop.yarn.api.records.timeline.TimelineEvent; //导入依赖的package包/类
/**
 * Creates an event object from the given key, offset, and value.  If the
 * event type is not contained in the specified set of event types,
 * returns null.
 */
private static TimelineEvent getEntityEvent(Set<String> eventTypes,
    byte[] key, int offset, byte[] value) throws IOException {
  KeyParser kp = new KeyParser(key, offset);
  long ts = kp.getNextLong();
  String tstype = kp.getNextString();
  if (eventTypes == null || eventTypes.contains(tstype)) {
    TimelineEvent event = new TimelineEvent();
    event.setTimestamp(ts);
    event.setEventType(tstype);
    Object o = GenericObjectMapper.read(value);
    if (o == null) {
      event.setEventInfo(null);
    } else if (o instanceof Map) {
      @SuppressWarnings("unchecked")
      Map<String, Object> m = (Map<String, Object>) o;
      event.setEventInfo(m);
    } else {
      throw new IOException("Couldn't deserialize event info map");
    }
    return event;
  }
  return null;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:29,代码来源:LeveldbTimelineStore.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IVersionedSerializer类代码示例发布时间:2022-05-22
下一篇:
Java SpanNotQuery类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap