eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qingwz...@apache.org
Subject incubator-eagle git commit: [MINOR] Update History Job Counting API
Date Wed, 28 Sep 2016 09:58:57 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master a1285351d -> 50ddd604c


[MINOR] Update History Job Counting API

add a query parameter 'jobType'

Author: Qingwen Zhao <qingwen220@gmail.com>

Closes #459 from qingwen220/historyJob.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/50ddd604
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/50ddd604
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/50ddd604

Branch: refs/heads/master
Commit: 50ddd604cf43ae6d86e57ca5b864314107565f00
Parents: a128535
Author: Qingwen Zhao <qingwen220@gmail.com>
Authored: Wed Sep 28 17:58:48 2016 +0800
Committer: Zhao, Qingwen <qingwzhao@ebay.com>
Committed: Wed Sep 28 17:58:48 2016 +0800

----------------------------------------------------------------------
 .../eagle/service/jpm/MRJobExecutionResource.java    | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/50ddd604/eagle-jpm/eagle-jpm-service/src/main/java/org/apache/eagle/service/jpm/MRJobExecutionResource.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-service/src/main/java/org/apache/eagle/service/jpm/MRJobExecutionResource.java
b/eagle-jpm/eagle-jpm-service/src/main/java/org/apache/eagle/service/jpm/MRJobExecutionResource.java
index 204412b..42b6584 100644
--- a/eagle-jpm/eagle-jpm-service/src/main/java/org/apache/eagle/service/jpm/MRJobExecutionResource.java
+++ b/eagle-jpm/eagle-jpm-service/src/main/java/org/apache/eagle/service/jpm/MRJobExecutionResource.java
@@ -324,7 +324,8 @@ public class MRJobExecutionResource {
     public JobCountResponse getJobCountGroupByDuration(@QueryParam("site") String site,
                                                        @QueryParam("timeDistInSecs") String
timeList,
                                                        @QueryParam("startTime") String startTime,
-                                                       @QueryParam("endTime") String endTime)
{
+                                                       @QueryParam("endTime") String endTime,
+                                                       @QueryParam("jobType") String jobType)
{
         JobCountResponse response = new JobCountResponse();
         if (site == null || startTime == null || endTime == null || timeList == null) {
             response.errMessage = "IllegalArgument: site, startTime, endTime, or timeDistInSecs
is null";
@@ -337,7 +338,17 @@ public class MRJobExecutionResource {
             return response;
         }
         try {
-            return helper.getHistoryJobCountGroupByDuration(historyRes.getObj(), timeList);
+            if (jobType != null) {
+                List<JobExecutionAPIEntity> jobs = new ArrayList<>();
+                for (JobExecutionAPIEntity o : historyRes.getObj()) {
+                    if (o.getTags().get(MRJobTagName.JOB_TYPE.toString()).equalsIgnoreCase(jobType))
{
+                        jobs.add(o);
+                    }
+                }
+                return helper.getHistoryJobCountGroupByDuration(jobs, timeList);
+            } else {
+                return helper.getHistoryJobCountGroupByDuration(historyRes.getObj(), timeList);
+            }
         } catch (Exception e) {
             response.errMessage = e.getMessage();
             return response;


Mime
View raw message