public QueueEntity() { super(TimelineEntityType.YARN_QUEUE.toString()); }
private void validateChild(Identifier child, TimelineEntityType thisType) { TimelineEntityType childType = TimelineEntityType.valueOf(child.getType()); if (!thisType.isChild(childType)) { throw new IllegalArgumentException( child.getType() + " is not the acceptable child of " + this.getType()); } } }
private void validateParent(String type) { TimelineEntityType parentType = TimelineEntityType.valueOf(type); TimelineEntityType thisType = TimelineEntityType.valueOf(getType()); if (!thisType.isParent(parentType)) { throw new IllegalArgumentException( type + " is not the acceptable parent of " + this.getType()); } }
public FlowActivityEntity(TimelineEntity entity) { super(entity); if (!TimelineEntityType.YARN_FLOW_ACTIVITY.matches(entity.getType())) { throw new IllegalArgumentException("Incompatible entity type: " + getId()); } // set config to null setConfigs(null); }
private static ApplicationAttemptEntity createAppAttemptEntity( ApplicationAttemptId appAttemptId) { ApplicationAttemptEntity entity = new ApplicationAttemptEntity(); entity.setId(appAttemptId.toString()); entity.setParent(new Identifier(TimelineEntityType.YARN_APPLICATION.name(), appAttemptId.getApplicationId().toString())); return entity; }
public void addChildren(Set<Identifier> children) { TimelineEntityType thisType = TimelineEntityType.valueOf(getType()); for (Identifier child : children) { validateChild(child, thisType); } Set<Identifier> existingChildren = getChildren(); existingChildren.addAll(children); setChildren(existingChildren); }
/** * Creates a timeline entity reader instance for reading a single entity with * the specified input. * * @param context Reader context which defines the scope in which query has to * be made. * @param dataToRetrieve Data to retrieve for each entity. * @return An implementation of <cite>TimelineEntityReader</cite> object * depending on entity type. */ public static TimelineEntityReader createSingleEntityReader( TimelineReaderContext context, TimelineDataToRetrieve dataToRetrieve) { // currently the types that are handled separate from the generic entity // table are application, flow run, and flow activity entities if (TimelineEntityType.YARN_APPLICATION.matches(context.getEntityType())) { return new ApplicationEntityReader(context, dataToRetrieve); } else if (TimelineEntityType. YARN_FLOW_RUN.matches(context.getEntityType())) { return new FlowRunEntityReader(context, dataToRetrieve); } else if (TimelineEntityType. YARN_FLOW_ACTIVITY.matches(context.getEntityType())) { return new FlowActivityEntityReader(context, dataToRetrieve); } else { // assume we're dealing with a generic entity read return new GenericEntityReader(context, dataToRetrieve); } }
private static ContainerEntity createContainerEntity( ContainerId containerId) { ContainerEntity entity = new ContainerEntity(); entity.setId(containerId.toString()); entity.setParent(new Identifier(TimelineEntityType.YARN_APPLICATION_ATTEMPT .name(), containerId.getApplicationAttemptId().toString())); return entity; }
@SuppressWarnings("unchecked") public Set<Identifier> getChildren() { Object identifiers = getInfo().get(CHILDREN_INFO_KEY); if (identifiers == null) { return new HashSet<>(); } TimelineEntityType thisType = TimelineEntityType.valueOf(getType()); if (identifiers instanceof Set<?>) { for (Object identifier : (Set<?>) identifiers) { if (!(identifier instanceof Identifier)) { throw new YarnRuntimeException( "Children info contains invalid identifier object"); } else { validateChild((Identifier) identifier, thisType); } } } else { throw new YarnRuntimeException( "Children info is invalid identifier set"); } Set<Identifier> children = (Set<Identifier>) identifiers; return children; }
public ContainerEntity() { super(TimelineEntityType.YARN_CONTAINER.toString()); }
if (TimelineEntityType.YARN_APPLICATION.matches(context.getEntityType())) { return new ApplicationEntityReader(context, filters, dataToRetrieve); } else if (TimelineEntityType. YARN_FLOW_ACTIVITY.matches(context.getEntityType())) { return new FlowActivityEntityReader(context, filters, dataToRetrieve); } else if (TimelineEntityType. YARN_FLOW_RUN.matches(context.getEntityType())) { return new FlowRunEntityReader(context, filters, dataToRetrieve); } else {
private static ContainerEntity createContainerEntity( ContainerId containerId) { ContainerEntity entity = new ContainerEntity(); entity.setId(containerId.toString()); Identifier parentIdentifier = new Identifier(); parentIdentifier .setType(TimelineEntityType.YARN_APPLICATION_ATTEMPT.name()); parentIdentifier.setId(containerId.getApplicationAttemptId().toString()); entity.setParent(parentIdentifier); return entity; }
public UserEntity() { super(TimelineEntityType.YARN_USER.toString()); }
public ClusterEntity() { super(TimelineEntityType.YARN_CLUSTER.toString()); }
public ApplicationAttemptEntity() { super(TimelineEntityType.YARN_APPLICATION_ATTEMPT.toString()); }
public ApplicationEntity() { super(TimelineEntityType.YARN_APPLICATION.toString()); }
/** * Whether the type of this entity matches the type indicated by the input * argument. * * @param typeString entity type represented as a string. * @return true, if string representation of this entity type matches the * entity type passed. */ public boolean matches(String typeString) { return toString().equals(typeString); } }
/** * Checks if the input TimelineEntity object is an ApplicationEntity. * * @param te TimelineEntity object. * @return true if input is an ApplicationEntity, false otherwise */ public static boolean isApplicationEntity(TimelineEntity te) { return (te == null ? false : te.getType().equals(TimelineEntityType.YARN_APPLICATION.toString())); }
public FlowRunEntity() { super(TimelineEntityType.YARN_FLOW_RUN.toString()); // set config to null setConfigs(null); }
public FlowActivityEntity() { super(TimelineEntityType.YARN_FLOW_ACTIVITY.toString()); // set config to null setConfigs(null); }