You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by vr...@apache.org on 2016/06/21 23:49:19 UTC
[33/50] [abbrv] hadoop git commit: YARN-5015. entire time series is
returned for YARN container system metrics (CPU and memory) (Varun Saxena via
sjlee)
http://git-wip-us.apache.org/repos/asf/hadoop/blob/fc78a937/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java
index 6ec59ea..fcab78c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServices.java
@@ -217,7 +217,10 @@ public class TimelineReaderWebServices {
* flowrun id and app id which are extracted from UID and then used to
* query backend(Mandatory path param).
* @param entityType Type of entities(Mandatory path param).
- * @param limit Number of entities to return(Optional query param).
+ * @param limit If specified, defines the number of entities to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched entities should not be
* created before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched entities should not be created
@@ -254,6 +257,13 @@ public class TimelineReaderWebServices {
* {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type, id and created time is returned
* (Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing
* a set of <cite>TimelineEntity</cite> instances of the given entity type
@@ -283,7 +293,8 @@ public class TimelineReaderWebServices {
@QueryParam("eventfilters") String eventfilters,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
String url = req.getRequestURI() +
(req.getQueryString() == null ? "" :
QUERY_STRING_SEP + req.getQueryString());
@@ -308,7 +319,7 @@ public class TimelineReaderWebServices {
limit, createdTimeStart, createdTimeEnd, relatesTo, isRelatedTo,
infofilters, conffilters, metricfilters, eventfilters),
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- confsToRetrieve, metricsToRetrieve, fields));
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit));
} catch (Exception e) {
handleException(e, url, startTime,
"createdTime start/end or limit or flowrunid");
@@ -342,7 +353,10 @@ public class TimelineReaderWebServices {
* query param).
* @param flowRunId Run id which should match for the entities(Optional query
* param).
- * @param limit Number of entities to return(Optional query param).
+ * @param limit If specified, defines the number of entities to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched entities should not be
* created before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched entities should not be created
@@ -379,6 +393,13 @@ public class TimelineReaderWebServices {
* {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type, id, created time is returned
* (Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing
* a set of <cite>TimelineEntity</cite> instances of the given entity type
@@ -413,11 +434,12 @@ public class TimelineReaderWebServices {
@QueryParam("eventfilters") String eventfilters,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
return getEntities(req, res, null, appId, entityType, userId, flowName,
flowRunId, limit, createdTimeStart, createdTimeEnd, relatesTo,
isRelatedTo, infofilters, conffilters, metricfilters, eventfilters,
- confsToRetrieve, metricsToRetrieve, fields);
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit);
}
/**
@@ -441,7 +463,10 @@ public class TimelineReaderWebServices {
* query param).
* @param flowRunId Run id which should match for the entities(Optional query
* param).
- * @param limit Number of entities to return(Optional query param).
+ * @param limit If specified, defines the number of entities to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched entities should not be
* created before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched entities should not be created
@@ -478,6 +503,13 @@ public class TimelineReaderWebServices {
* {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type, id, created time is returned
* (Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing
* a set of <cite>TimelineEntity</cite> instances of the given entity type
@@ -513,7 +545,8 @@ public class TimelineReaderWebServices {
@QueryParam("eventfilters") String eventfilters,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
String url = req.getRequestURI() +
(req.getQueryString() == null ? "" :
QUERY_STRING_SEP + req.getQueryString());
@@ -533,7 +566,7 @@ public class TimelineReaderWebServices {
limit, createdTimeStart, createdTimeEnd, relatesTo, isRelatedTo,
infofilters, conffilters, metricfilters, eventfilters),
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- confsToRetrieve, metricsToRetrieve, fields));
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit));
} catch (Exception e) {
handleException(e, url, startTime,
"createdTime start/end or limit or flowrunid");
@@ -568,6 +601,13 @@ public class TimelineReaderWebServices {
* {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type, id, created time is returned
* (Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing a
* <cite>TimelineEntity</cite> instance is returned.<br>
@@ -588,7 +628,8 @@ public class TimelineReaderWebServices {
@PathParam("uid") String uId,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
String url = req.getRequestURI() +
(req.getQueryString() == null ? "" :
QUERY_STRING_SEP + req.getQueryString());
@@ -608,7 +649,7 @@ public class TimelineReaderWebServices {
}
entity = timelineReaderManager.getEntity(context,
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- confsToRetrieve, metricsToRetrieve, fields));
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit));
} catch (Exception e) {
handleException(e, url, startTime, "flowrunid");
}
@@ -655,6 +696,13 @@ public class TimelineReaderWebServices {
* {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type, id, created time is returned
* (Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing a
* <cite>TimelineEntity</cite> instance is returned.<br>
@@ -680,9 +728,11 @@ public class TimelineReaderWebServices {
@QueryParam("flowrunid") String flowRunId,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
return getEntity(req, res, null, appId, entityType, entityId, userId,
- flowName, flowRunId, confsToRetrieve, metricsToRetrieve, fields);
+ flowName, flowRunId, confsToRetrieve, metricsToRetrieve, fields,
+ metricsLimit);
}
/**
@@ -717,6 +767,13 @@ public class TimelineReaderWebServices {
* {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type, id and created time is returned
* (Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing a
* <cite>TimelineEntity</cite> instance is returned.<br>
@@ -743,7 +800,8 @@ public class TimelineReaderWebServices {
@QueryParam("flowrunid") String flowRunId,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
String url = req.getRequestURI() +
(req.getQueryString() == null ? "" :
QUERY_STRING_SEP + req.getQueryString());
@@ -760,7 +818,7 @@ public class TimelineReaderWebServices {
TimelineReaderWebServicesUtils.createTimelineReaderContext(
clusterId, userId, flowName, flowRunId, appId, entityType, entityId),
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- confsToRetrieve, metricsToRetrieve, fields));
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit));
} catch (Exception e) {
handleException(e, url, startTime, "flowrunid");
}
@@ -827,7 +885,7 @@ public class TimelineReaderWebServices {
context.setEntityType(TimelineEntityType.YARN_FLOW_RUN.toString());
entity = timelineReaderManager.getEntity(context,
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- null, metricsToRetrieve, null));
+ null, metricsToRetrieve, null, null));
} catch (Exception e) {
handleException(e, url, startTime, "flowrunid");
}
@@ -936,7 +994,7 @@ public class TimelineReaderWebServices {
clusterId, userId, flowName, flowRunId, null,
TimelineEntityType.YARN_FLOW_RUN.toString(), null),
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- null, metricsToRetrieve, null));
+ null, metricsToRetrieve, null, null));
} catch (Exception e) {
handleException(e, url, startTime, "flowrunid");
}
@@ -963,7 +1021,10 @@ public class TimelineReaderWebServices {
* @param uId a delimited string containing clusterid, userid, and flow name
* which are extracted from UID and then used to query backend(Mandatory
* path param).
- * @param limit Number of flow runs to return(Optional query param).
+ * @param limit If specified, defines the number of flow runs to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched flow runs should not be
* created before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched flow runs should not be created
@@ -972,10 +1033,11 @@ public class TimelineReaderWebServices {
* and send back in response. These metrics will be retrieved
* irrespective of whether metrics are specified in fields to retrieve or
* not.
- * @param fields Specifies which fields to retrieve, see {@link Field}.
- * All fields will be retrieved if fields=ALL. Fields other than METRICS
- * have no meaning for this REST endpoint. If not specified, all fields
- * other than metrics are returned(Optional query param).
+ * @param fields Specifies which fields to retrieve, see {@link Field}. All
+ * fields will be retrieved if fields=ALL. Amongst all the fields, only
+ * METRICS makes sense for flow runs hence only ALL or METRICS are
+ * supported as fields for fetching flow runs. Other fields will lead to
+ * HTTP 400 (Bad Request) response. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing a
* set of <cite>FlowRunEntity</cite> instances for the given flow are
@@ -1021,7 +1083,7 @@ public class TimelineReaderWebServices {
limit, createdTimeStart, createdTimeEnd, null, null, null,
null, null, null),
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- null, metricsToRetrieve, fields));
+ null, metricsToRetrieve, fields, null));
} catch (Exception e) {
handleException(e, url, startTime, "createdTime start/end or limit");
}
@@ -1044,7 +1106,10 @@ public class TimelineReaderWebServices {
* Mandatory path param)
* @param flowName Flow name to which the flow runs to be queried belongs to(
* Mandatory path param).
- * @param limit Number of flow runs to return(Optional query param).
+ * @param limit If specified, defines the number of flow runs to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched flow runs should not be
* created before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched flow runs should not be created
@@ -1053,10 +1118,11 @@ public class TimelineReaderWebServices {
* and send back in response. These metrics will be retrieved
* irrespective of whether metrics are specified in fields to retrieve or
* not.
- * @param fields Specifies which fields to retrieve, see {@link Field}.
- * All fields will be retrieved if fields=ALL. Fields other than METRICS
- * have no meaning for this REST endpoint. If not specified, all fields
- * other than metrics are returned(Optional query param).
+ * @param fields Specifies which fields to retrieve, see {@link Field}. All
+ * fields will be retrieved if fields=ALL. Amongst all the fields, only
+ * METRICS makes sense for flow runs hence only ALL or METRICS are
+ * supported as fields for fetching flow runs. Other fields will lead to
+ * HTTP 400 (Bad Request) response. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing a
* set of <cite>FlowRunEntity</cite> instances for the given flow are
@@ -1095,7 +1161,10 @@ public class TimelineReaderWebServices {
* Mandatory path param)
* @param flowName Flow name to which the flow runs to be queried belongs to(
* Mandatory path param).
- * @param limit Number of flow runs to return(Optional query param).
+ * @param limit If specified, defines the number of flow runs to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched flow runs should not be
* created before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched flow runs should not be created
@@ -1104,10 +1173,11 @@ public class TimelineReaderWebServices {
* and send back in response. These metrics will be retrieved
* irrespective of whether metrics are specified in fields to retrieve or
* not.
- * @param fields Specifies which fields to retrieve, see {@link Field}.
- * All fields will be retrieved if fields=ALL. Fields other than METRICS
- * have no meaning for this REST endpoint. If not specified, all fields
- * other than metrics are returned(Optional query param).
+ * @param fields Specifies which fields to retrieve, see {@link Field}. All
+ * fields will be retrieved if fields=ALL. Amongst all the fields, only
+ * METRICS makes sense for flow runs hence only ALL or METRICS are
+ * supported as fields for fetching flow runs. Other fields will lead to
+ * HTTP 400 (Bad Request) response. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing a
* set of <cite>FlowRunEntity</cite> instances for the given flow are
@@ -1152,7 +1222,7 @@ public class TimelineReaderWebServices {
limit, createdTimeStart, createdTimeEnd, null, null, null,
null, null, null),
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- null, metricsToRetrieve, fields));
+ null, metricsToRetrieve, fields, null));
} catch (Exception e) {
handleException(e, url, startTime, "createdTime start/end or limit");
}
@@ -1171,7 +1241,10 @@ public class TimelineReaderWebServices {
*
* @param req Servlet request.
* @param res Servlet response.
- * @param limit Number of flows to return(Optional query param).
+ * @param limit If specified, defines the number of flows to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param dateRange If specified is given as "[startdate]-[enddate]"(i.e.
* start and end date separated by "-") or single date. Dates are
* interpreted in yyyyMMdd format and are assumed to be in GMT(Optional
@@ -1214,7 +1287,10 @@ public class TimelineReaderWebServices {
* @param res Servlet response.
* @param clusterId Cluster id to which the flows to be queried belong to(
* Mandatory path param).
- * @param limit Number of flows to return(Optional query param).
+ * @param limit If specified, defines the number of flows to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param dateRange If specified is given as "[startdate]-[enddate]"(i.e.
* start and end date separated by "-") or single date. Dates are
* interpreted in yyyyMMdd format and are assumed to be in GMT(Optional
@@ -1271,7 +1347,7 @@ public class TimelineReaderWebServices {
clusterId, null, null, null, null,
TimelineEntityType.YARN_FLOW_ACTIVITY.toString(), null),
entityFilters, TimelineReaderWebServicesUtils.
- createTimelineDataToRetrieve(null, null, null));
+ createTimelineDataToRetrieve(null, null, null, null));
} catch (Exception e) {
handleException(e, url, startTime, "limit");
}
@@ -1305,6 +1381,13 @@ public class TimelineReaderWebServices {
* see {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type(equivalent to YARN_APPLICATION),
* app id and app created time is returned(Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing a
* <cite>TimelineEntity</cite> instance is returned.<br>
@@ -1325,7 +1408,8 @@ public class TimelineReaderWebServices {
@PathParam("uid") String uId,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
String url = req.getRequestURI() +
(req.getQueryString() == null ? "" :
QUERY_STRING_SEP + req.getQueryString());
@@ -1346,7 +1430,7 @@ public class TimelineReaderWebServices {
context.setEntityType(TimelineEntityType.YARN_APPLICATION.toString());
entity = timelineReaderManager.getEntity(context,
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- confsToRetrieve, metricsToRetrieve, fields));
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit));
} catch (Exception e) {
handleException(e, url, startTime, "flowrunid");
}
@@ -1388,6 +1472,13 @@ public class TimelineReaderWebServices {
* see {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type(equivalent to YARN_APPLICATION),
* app id and app created time is returned(Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing a
* <cite>TimelineEntity</cite> instance is returned.<br>
@@ -1411,9 +1502,10 @@ public class TimelineReaderWebServices {
@QueryParam("userid") String userId,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
return getApp(req, res, null, appId, flowName, flowRunId, userId,
- confsToRetrieve, metricsToRetrieve, fields);
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit);
}
/**
@@ -1444,6 +1536,13 @@ public class TimelineReaderWebServices {
* see {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type(equivalent to YARN_APPLICATION),
* app id and app created time is returned(Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing a
* <cite>TimelineEntity</cite> instance is returned.<br>
@@ -1468,7 +1567,8 @@ public class TimelineReaderWebServices {
@QueryParam("userid") String userId,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
String url = req.getRequestURI() +
(req.getQueryString() == null ? "" :
QUERY_STRING_SEP + req.getQueryString());
@@ -1486,7 +1586,7 @@ public class TimelineReaderWebServices {
clusterId, userId, flowName, flowRunId, appId,
TimelineEntityType.YARN_APPLICATION.toString(), null),
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- confsToRetrieve, metricsToRetrieve, fields));
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit));
} catch (Exception e) {
handleException(e, url, startTime, "flowrunid");
}
@@ -1512,7 +1612,10 @@ public class TimelineReaderWebServices {
* @param uId a delimited string containing clusterid, userid, flow name and
* flowrun id which are extracted from UID and then used to query backend.
* (Mandatory path param).
- * @param limit Number of apps to return(Optional query param).
+ * @param limit If specified, defines the number of apps to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched apps should not be created
* before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched apps should not be created
@@ -1549,6 +1652,13 @@ public class TimelineReaderWebServices {
* see {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type(equivalent to YARN_APPLICATION),
* app id and app created time is returned(Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing
* a set of <cite>TimelineEntity</cite> instances representing apps is
@@ -1577,7 +1687,8 @@ public class TimelineReaderWebServices {
@QueryParam("eventfilters") String eventfilters,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
String url = req.getRequestURI() +
(req.getQueryString() == null ? "" :
QUERY_STRING_SEP + req.getQueryString());
@@ -1601,7 +1712,7 @@ public class TimelineReaderWebServices {
limit, createdTimeStart, createdTimeEnd, relatesTo, isRelatedTo,
infofilters, conffilters, metricfilters, eventfilters),
TimelineReaderWebServicesUtils.createTimelineDataToRetrieve(
- confsToRetrieve, metricsToRetrieve, fields));
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit));
} catch (Exception e) {
handleException(e, url, startTime,
"createdTime start/end or limit or flowrunid");
@@ -1628,7 +1739,10 @@ public class TimelineReaderWebServices {
* param).
* @param flowRunId Run id which should match for the apps(Mandatory path
* param).
- * @param limit Number of apps to return(Optional query param).
+ * @param limit If specified, defines the number of apps to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched apps should not be created
* before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched apps should not be created
@@ -1665,6 +1779,13 @@ public class TimelineReaderWebServices {
* see {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type(equivalent to YARN_APPLICATION),
* app id and app created time is returned(Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing
* a set of <cite>TimelineEntity</cite> instances representing apps is
@@ -1695,12 +1816,13 @@ public class TimelineReaderWebServices {
@QueryParam("eventfilters") String eventfilters,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
return getEntities(req, res, null, null,
TimelineEntityType.YARN_APPLICATION.toString(), userId, flowName,
flowRunId, limit, createdTimeStart, createdTimeEnd, relatesTo,
isRelatedTo, infofilters, conffilters, metricfilters, eventfilters,
- confsToRetrieve, metricsToRetrieve, fields);
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit);
}
/**
@@ -1717,7 +1839,10 @@ public class TimelineReaderWebServices {
* param).
* @param flowRunId Run id which should match for the apps(Mandatory path
* param).
- * @param limit Number of apps to return(Optional query param).
+ * @param limit If specified, defines the number of apps to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched apps should not be created
* before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched apps should not be created
@@ -1754,6 +1879,13 @@ public class TimelineReaderWebServices {
* see {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type(equivalent to YARN_APPLICATION),
* app id and app created time is returned(Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing
* a set of <cite>TimelineEntity</cite> instances representing apps is
@@ -1786,12 +1918,13 @@ public class TimelineReaderWebServices {
@QueryParam("eventfilters") String eventfilters,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
return getEntities(req, res, clusterId, null,
TimelineEntityType.YARN_APPLICATION.toString(), userId, flowName,
flowRunId, limit, createdTimeStart, createdTimeEnd, relatesTo,
isRelatedTo, infofilters, conffilters, metricfilters, eventfilters,
- confsToRetrieve, metricsToRetrieve, fields);
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit);
}
/**
@@ -1805,7 +1938,10 @@ public class TimelineReaderWebServices {
* @param userId User id which should match for the apps(Mandatory path param)
* @param flowName Flow name which should match for the apps(Mandatory path
* param).
- * @param limit Number of apps to return(Optional query param).
+ * @param limit If specified, defines the number of apps to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched apps should not be created
* before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched apps should not be created
@@ -1842,6 +1978,13 @@ public class TimelineReaderWebServices {
* see {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type(equivalent to YARN_APPLICATION),
* app id and app created time is returned(Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing
* a set of <cite>TimelineEntity</cite> instances representing apps is
@@ -1871,19 +2014,19 @@ public class TimelineReaderWebServices {
@QueryParam("eventfilters") String eventfilters,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
return getEntities(req, res, null, null,
TimelineEntityType.YARN_APPLICATION.toString(), userId, flowName,
null, limit, createdTimeStart, createdTimeEnd, relatesTo, isRelatedTo,
infofilters, conffilters, metricfilters, eventfilters,
- confsToRetrieve, metricsToRetrieve, fields);
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit);
}
/**
* Return a list of apps for a given user, cluster id and flow name. If number
* of matching apps are more than the limit, most recent apps till the limit
- * is reached, will be returned. If number of matching apps are more than the
- * limit, most recent apps till the limit is reached, will be returned.
+ * is reached, will be returned.
*
* @param req Servlet request.
* @param res Servlet response.
@@ -1892,7 +2035,10 @@ public class TimelineReaderWebServices {
* @param userId User id which should match for the apps(Mandatory path param)
* @param flowName Flow name which should match for the apps(Mandatory path
* param).
- * @param limit Number of apps to return(Optional query param).
+ * @param limit If specified, defines the number of apps to return. The
+ * maximum possible value for limit can be {@link Long#MAX_VALUE}. If it
+ * is not specified or has a value less than 0, then limit will be
+ * considered as 100. (Optional query param).
* @param createdTimeStart If specified, matched apps should not be created
* before this timestamp(Optional query param).
* @param createdTimeEnd If specified, matched apps should not be created
@@ -1929,6 +2075,13 @@ public class TimelineReaderWebServices {
* see {@link Field}. All fields will be retrieved if fields=ALL. If not
* specified, 3 fields i.e. entity type(equivalent to YARN_APPLICATION),
* app id and app created time is returned(Optional query param).
+ * @param metricsLimit If specified, defines the number of metrics to return.
+ * Considered only if fields contains METRICS/ALL or metricsToRetrieve is
+ * specified. Ignored otherwise. The maximum possible value for
+ * metricsLimit can be {@link Integer#MAX_VALUE}. If it is not specified
+ * or has a value less than 1, and metrics have to be retrieved, then
+ * metricsLimit will be considered as 1 i.e. latest single value of
+ * metric(s) will be returned. (Optional query param).
*
* @return If successful, a HTTP 200(OK) response having a JSON representing
* a set of <cite>TimelineEntity</cite> instances representing apps is
@@ -1959,11 +2112,12 @@ public class TimelineReaderWebServices {
@QueryParam("eventfilters") String eventfilters,
@QueryParam("confstoretrieve") String confsToRetrieve,
@QueryParam("metricstoretrieve") String metricsToRetrieve,
- @QueryParam("fields") String fields) {
+ @QueryParam("fields") String fields,
+ @QueryParam("metricslimit") String metricsLimit) {
return getEntities(req, res, clusterId, null,
TimelineEntityType.YARN_APPLICATION.toString(), userId, flowName,
null, limit, createdTimeStart, createdTimeEnd, relatesTo, isRelatedTo,
infofilters, conffilters, metricfilters, eventfilters,
- confsToRetrieve, metricsToRetrieve, fields);
+ confsToRetrieve, metricsToRetrieve, fields, metricsLimit);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/fc78a937/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServicesUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServicesUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServicesUtils.java
index 2e667d6..7fc8cb8 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServicesUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderWebServicesUtils.java
@@ -87,14 +87,16 @@ final class TimelineReaderWebServicesUtils {
* @param confs confs to retrieve.
* @param metrics metrics to retrieve.
* @param fields fields to retrieve.
+ * @param metricsLimit upper limit on number of metrics to return.
* @return a {@link TimelineDataToRetrieve} object.
* @throws TimelineParseException if any problem occurs during parsing.
*/
static TimelineDataToRetrieve createTimelineDataToRetrieve(String confs,
- String metrics, String fields) throws TimelineParseException {
+ String metrics, String fields, String metricsLimit)
+ throws TimelineParseException {
return new TimelineDataToRetrieve(parseDataToRetrieve(confs),
- parseDataToRetrieve(metrics), parseFieldsStr(
- fields, TimelineParseConstants.COMMA_DELIMITER));
+ parseDataToRetrieve(metrics), parseFieldsStr(fields,
+ TimelineParseConstants.COMMA_DELIMITER), parseIntStr(metricsLimit));
}
/**
@@ -191,6 +193,15 @@ final class TimelineReaderWebServicesUtils {
}
/**
+ * Interpret passed string as a integer.
+ * @param str Passed string.
+ * @return integer representation if string is not null, null otherwise.
+ */
+ static Integer parseIntStr(String str) {
+ return str == null ? null : Integer.parseInt(str.trim());
+ }
+
+ /**
* Trims the passed string if its not null.
* @param str Passed string.
* @return trimmed string if string is not null, null otherwise.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/fc78a937/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/ApplicationEntityReader.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/ApplicationEntityReader.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/ApplicationEntityReader.java
index 71c90fb..8e806bc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/ApplicationEntityReader.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/ApplicationEntityReader.java
@@ -312,7 +312,7 @@ class ApplicationEntityReader extends GenericEntityReader {
ApplicationRowKey.getRowKey(context.getClusterId(), context.getUserId(),
context.getFlowName(), context.getFlowRunId(), context.getAppId());
Get get = new Get(rowKey);
- get.setMaxVersions(Integer.MAX_VALUE);
+ get.setMaxVersions(getDataToRetrieve().getMetricsLimit());
if (filterList != null && !filterList.getFilters().isEmpty()) {
get.setFilter(filterList);
}
@@ -382,6 +382,7 @@ class ApplicationEntityReader extends GenericEntityReader {
newList.addFilter(filterList);
}
scan.setFilter(newList);
+ scan.setMaxVersions(getDataToRetrieve().getMetricsLimit());
return getTable().getResultScanner(hbaseConf, conn, scan);
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/fc78a937/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/FlowRunEntityReader.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/FlowRunEntityReader.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/FlowRunEntityReader.java
index b2de2e5..e1695ef 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/FlowRunEntityReader.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/FlowRunEntityReader.java
@@ -18,6 +18,7 @@
package org.apache.hadoop.yarn.server.timelineservice.storage.reader;
import java.io.IOException;
+import java.util.EnumSet;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.client.Connection;
@@ -48,6 +49,7 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunColumnF
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunColumnPrefix;
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunRowKey;
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunTable;
+import org.apache.hadoop.yarn.webapp.BadRequestException;
import com.google.common.base.Preconditions;
@@ -91,6 +93,15 @@ class FlowRunEntityReader extends TimelineEntityReader {
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.");
+ }
+ }
+ }
}
@Override
@@ -209,6 +220,7 @@ class FlowRunEntityReader extends TimelineEntityReader {
newList.addFilter(filterList);
}
scan.setFilter(newList);
+ scan.setMaxVersions(Integer.MAX_VALUE);
return getTable().getResultScanner(hbaseConf, conn, scan);
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/fc78a937/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/GenericEntityReader.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/GenericEntityReader.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/GenericEntityReader.java
index 878695c..22583b5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/GenericEntityReader.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/GenericEntityReader.java
@@ -489,7 +489,7 @@ class GenericEntityReader extends TimelineEntityReader {
context.getFlowName(), context.getFlowRunId(), context.getAppId(),
context.getEntityType(), context.getEntityId());
Get get = new Get(rowKey);
- get.setMaxVersions(Integer.MAX_VALUE);
+ get.setMaxVersions(getDataToRetrieve().getMetricsLimit());
if (filterList != null && !filterList.getFilters().isEmpty()) {
get.setFilter(filterList);
}
@@ -506,7 +506,7 @@ class GenericEntityReader extends TimelineEntityReader {
scan.setRowPrefixFilter(EntityRowKey.getRowKeyPrefix(
context.getClusterId(), context.getUserId(), context.getFlowName(),
context.getFlowRunId(), context.getAppId(), context.getEntityType()));
- scan.setMaxVersions(Integer.MAX_VALUE);
+ scan.setMaxVersions(getDataToRetrieve().getMetricsLimit());
if (filterList != null && !filterList.getFilters().isEmpty()) {
scan.setFilter(filterList);
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/fc78a937/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/TimelineEntityReader.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/TimelineEntityReader.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/TimelineEntityReader.java
index be27643..852834e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/TimelineEntityReader.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/reader/TimelineEntityReader.java
@@ -338,8 +338,9 @@ public abstract class TimelineEntityReader {
metric.setId(metricResult.getKey());
// Simply assume that if the value set contains more than 1 elements, the
// metric is a TIME_SERIES metric, otherwise, it's a SINGLE_VALUE metric
- metric.setType(metricResult.getValue().size() > 1 ?
- TimelineMetric.Type.TIME_SERIES : TimelineMetric.Type.SINGLE_VALUE);
+ TimelineMetric.Type metricType = metricResult.getValue().size() > 1 ?
+ TimelineMetric.Type.TIME_SERIES : TimelineMetric.Type.SINGLE_VALUE;
+ metric.setType(metricType);
metric.addValues(metricResult.getValue());
entity.addMetric(metric);
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/fc78a937/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestFileSystemTimelineReaderImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestFileSystemTimelineReaderImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestFileSystemTimelineReaderImpl.java
index ad2122c..2af7817 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestFileSystemTimelineReaderImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestFileSystemTimelineReaderImpl.java
@@ -274,7 +274,7 @@ public class TestFileSystemTimelineReaderImpl {
TimelineEntity result = reader.getEntity(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", "id_1"),
- new TimelineDataToRetrieve(null, null, null));
+ new TimelineDataToRetrieve(null, null, null, null));
Assert.assertEquals(
(new TimelineEntity.Identifier("app", "id_1")).toString(),
result.getIdentifier().toString());
@@ -289,7 +289,7 @@ public class TestFileSystemTimelineReaderImpl {
TimelineEntity result = reader.getEntity(
new TimelineReaderContext("cluster1", null, null, null, "app1", "app",
"id_1"),
- new TimelineDataToRetrieve(null, null, null));
+ new TimelineDataToRetrieve(null, null, null, null));
Assert.assertEquals(
(new TimelineEntity.Identifier("app", "id_1")).toString(),
result.getIdentifier().toString());
@@ -306,7 +306,7 @@ public class TestFileSystemTimelineReaderImpl {
TimelineEntity result = reader.getEntity(
new TimelineReaderContext("cluster1", null, null, null, "app2",
"app", "id_5"),
- new TimelineDataToRetrieve(null, null, null));
+ new TimelineDataToRetrieve(null, null, null, null));
Assert.assertEquals(
(new TimelineEntity.Identifier("app", "id_5")).toString(),
result.getIdentifier().toString());
@@ -320,7 +320,7 @@ public class TestFileSystemTimelineReaderImpl {
new TimelineReaderContext("cluster1","user1", "flow1", 1L, "app1",
"app", "id_1"),
new TimelineDataToRetrieve(null, null,
- EnumSet.of(Field.INFO, Field.CONFIGS, Field.METRICS)));
+ EnumSet.of(Field.INFO, Field.CONFIGS, Field.METRICS), null));
Assert.assertEquals(
(new TimelineEntity.Identifier("app", "id_1")).toString(),
result.getIdentifier().toString());
@@ -338,7 +338,7 @@ public class TestFileSystemTimelineReaderImpl {
TimelineEntity result = reader.getEntity(
new TimelineReaderContext("cluster1","user1", "flow1", 1L, "app1",
"app", "id_1"),
- new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL)));
+ new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
Assert.assertEquals(
(new TimelineEntity.Identifier("app", "id_1")).toString(),
result.getIdentifier().toString());
@@ -354,7 +354,7 @@ public class TestFileSystemTimelineReaderImpl {
Set<TimelineEntity> result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null), new TimelineEntityFilters(),
- new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL)));
+ new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
// All 4 entities will be returned
Assert.assertEquals(4, result.size());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org