Search in sources :

Example 6 with Field

use of org.apache.hadoop.yarn.server.timelineservice.storage.TimelineReader.Field in project hadoop by apache.

the class FlowRunEntityReader method validateParams.

@Override
protected void validateParams() {
    Preconditions.checkNotNull(getContext(), "context shouldn't be null");
    Preconditions.checkNotNull(getDataToRetrieve(), "data to retrieve shouldn't be null");
    Preconditions.checkNotNull(getContext().getClusterId(), "clusterId shouldn't be null");
    Preconditions.checkNotNull(getContext().getUserId(), "userId shouldn't be null");
    Preconditions.checkNotNull(getContext().getFlowName(), "flowName shouldn't be null");
    if (isSingleEntityRead()) {
        Preconditions.checkNotNull(getContext().getFlowRunId(), "flowRunId shouldn't be null");
    }
    EnumSet<Field> fieldsToRetrieve = getDataToRetrieve().getFieldsToRetrieve();
    if (!isSingleEntityRead() && fieldsToRetrieve != null) {
        for (Field field : fieldsToRetrieve) {
            if (field != Field.ALL && field != Field.METRICS) {
                throw new BadRequestException("Invalid field " + field + " specified while querying flow runs.");
            }
        }
    }
}
Also used : Field(org.apache.hadoop.yarn.server.timelineservice.storage.TimelineReader.Field) BadRequestException(org.apache.hadoop.yarn.webapp.BadRequestException)

Aggregations

Field (org.apache.hadoop.yarn.server.timelineservice.storage.TimelineReader.Field)6 TimelineEntityFilters (org.apache.hadoop.yarn.server.timelineservice.reader.TimelineEntityFilters)3 EnumSet (java.util.EnumSet)2 Set (java.util.Set)2 FilterList (org.apache.hadoop.hbase.filter.FilterList)2 TimelineEntity (org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity)2 TimelineFilterList (org.apache.hadoop.yarn.server.timelineservice.reader.filter.TimelineFilterList)2 BadRequestException (org.apache.hadoop.yarn.webapp.BadRequestException)1