Java Code Examples for org.apache.hadoop.yarn.api.records.timeline.TimelineEntity#setOtherInfo()

The following examples show how to use org.apache.hadoop.yarn.api.records.timeline.TimelineEntity#setOtherInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemMetricsPublisher.java    From hadoop with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 2
Source File: SystemMetricsPublisher.java    From hadoop with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: TimelineStoreTestUtils.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: SystemMetricsPublisher.java    From big-c with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 5
Source File: SystemMetricsPublisher.java    From big-c with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 6
Source File: TimelineStoreTestUtils.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 7
Source File: SystemMetricsPublisher.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void publishApplicationACLsUpdatedEvent(
    ApplicationACLsUpdatedEvent event) {
  TimelineEntity entity =
      createApplicationEntity(event.getApplicationId());
  TimelineEvent tEvent = new TimelineEvent();
  Map<String, Object> entityInfo = new HashMap<String, Object>();
  entityInfo.put(ApplicationMetricsConstants.APP_VIEW_ACLS_ENTITY_INFO,
      event.getViewAppACLs());
  entity.setOtherInfo(entityInfo);
  tEvent.setEventType(
      ApplicationMetricsConstants.ACLS_UPDATED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
Example 8
Source File: MemoryTimelineStore.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private static TimelineEntity maskFields(
    TimelineEntity entity, EnumSet<Field> fields) {
  // Conceal the fields that are not going to be exposed
  TimelineEntity entityToReturn = new TimelineEntity();
  entityToReturn.setEntityId(entity.getEntityId());
  entityToReturn.setEntityType(entity.getEntityType());
  entityToReturn.setStartTime(entity.getStartTime());
  entityToReturn.setDomainId(entity.getDomainId());
  // Deep copy
  if (fields.contains(Field.EVENTS)) {
    entityToReturn.addEvents(entity.getEvents());
  } else if (fields.contains(Field.LAST_EVENT_ONLY)) {
    entityToReturn.addEvent(entity.getEvents().get(0));
  } else {
    entityToReturn.setEvents(null);
  }
  if (fields.contains(Field.RELATED_ENTITIES)) {
    entityToReturn.addRelatedEntities(entity.getRelatedEntities());
  } else {
    entityToReturn.setRelatedEntities(null);
  }
  if (fields.contains(Field.PRIMARY_FILTERS)) {
    entityToReturn.addPrimaryFilters(entity.getPrimaryFilters());
  } else {
    entityToReturn.setPrimaryFilters(null);
  }
  if (fields.contains(Field.OTHER_INFO)) {
    entityToReturn.addOtherInfo(entity.getOtherInfo());
  } else {
    entityToReturn.setOtherInfo(null);
  }
  return entityToReturn;
}
 
Example 9
Source File: SystemMetricsPublisher.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void publishApplicationACLsUpdatedEvent(
    ApplicationACLsUpdatedEvent event) {
  TimelineEntity entity =
      createApplicationEntity(event.getApplicationId());
  TimelineEvent tEvent = new TimelineEvent();
  Map<String, Object> entityInfo = new HashMap<String, Object>();
  entityInfo.put(ApplicationMetricsConstants.APP_VIEW_ACLS_ENTITY_INFO,
      event.getViewAppACLs());
  entity.setOtherInfo(entityInfo);
  tEvent.setEventType(
      ApplicationMetricsConstants.ACLS_UPDATED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
Example 10
Source File: MemoryTimelineStore.java    From big-c with Apache License 2.0 5 votes vote down vote up
private static TimelineEntity maskFields(
    TimelineEntity entity, EnumSet<Field> fields) {
  // Conceal the fields that are not going to be exposed
  TimelineEntity entityToReturn = new TimelineEntity();
  entityToReturn.setEntityId(entity.getEntityId());
  entityToReturn.setEntityType(entity.getEntityType());
  entityToReturn.setStartTime(entity.getStartTime());
  entityToReturn.setDomainId(entity.getDomainId());
  // Deep copy
  if (fields.contains(Field.EVENTS)) {
    entityToReturn.addEvents(entity.getEvents());
  } else if (fields.contains(Field.LAST_EVENT_ONLY)) {
    entityToReturn.addEvent(entity.getEvents().get(0));
  } else {
    entityToReturn.setEvents(null);
  }
  if (fields.contains(Field.RELATED_ENTITIES)) {
    entityToReturn.addRelatedEntities(entity.getRelatedEntities());
  } else {
    entityToReturn.setRelatedEntities(null);
  }
  if (fields.contains(Field.PRIMARY_FILTERS)) {
    entityToReturn.addPrimaryFilters(entity.getPrimaryFilters());
  } else {
    entityToReturn.setPrimaryFilters(null);
  }
  if (fields.contains(Field.OTHER_INFO)) {
    entityToReturn.addOtherInfo(entity.getOtherInfo());
  } else {
    entityToReturn.setOtherInfo(null);
  }
  return entityToReturn;
}