falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sowmya...@apache.org
Subject falcon git commit: FALCON-1244 numResults query param in listInstances is ignored when start and end params are not specified. Contributed by Balu Vellanki
Date Tue, 02 Jun 2015 22:14:13 GMT
Repository: falcon
Updated Branches:
  refs/heads/master 1bae2a6f2 -> 7532a5864


FALCON-1244 numResults query param in listInstances is ignored when start and end params are
not specified. Contributed by Balu Vellanki


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/7532a586
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/7532a586
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/7532a586

Branch: refs/heads/master
Commit: 7532a5864eb9d0a9ae2f09b8af9ae5d05f04bc82
Parents: 1bae2a6
Author: Sowmya Ramesh <sramesh@hortonworks.com>
Authored: Tue Jun 2 15:14:08 2015 -0700
Committer: Sowmya Ramesh <sramesh@hortonworks.com>
Committed: Tue Jun 2 15:14:08 2015 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  6 +++++
 .../resource/AbstractInstanceManager.java       | 26 ++++++++++++--------
 .../resource/proxy/InstanceManagerProxy.java    |  1 -
 3 files changed, 22 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/7532a586/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 89b8d46..235f5bf 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -29,6 +29,12 @@ Trunk (Unreleased)
     (Suhas Vasu)
 
   BUG FIXES
+    FALCON-1244 numResults query param in listInstances is ignored when start and end params
are not specified
+    (Balu Vellanki via Sowmya Ramesh)
+
+    FALCON-1121 Backend support for free-text entity search
+    (Ying Zheng via Sowmya Ramesh)
+
     FALCON-1051 Lineage apis broken for falcon setup in distributed mode
     (Pavan Kumar Kolamuri via Ajay Yadava)
     

http://git-wip-us.apache.org/repos/asf/falcon/blob/7532a586/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
index f0c4596..42907c8 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
@@ -49,6 +49,7 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
     private static final long HOUR_IN_MILLIS = 3600000L;
     protected static final long DAY_IN_MILLIS = 86400000L;
     private static final long MONTH_IN_MILLIS = 2592000000L;
+    protected static final String DEFAULT_NUM_RESULTS = "10";
 
     protected EntityType checkType(String type) {
         if (StringUtils.isEmpty(type)) {
@@ -145,7 +146,7 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
             validateParams(type, entity);
             validateInstanceFilterByClause(filterBy);
             Entity entityObject = EntityUtil.getEntity(type, entity);
-            Pair<Date, Date> startAndEndDate = getStartAndEndDate(entityObject, startStr,
endStr);
+            Pair<Date, Date> startAndEndDate = getStartAndEndDate(entityObject, startStr,
endStr, numResults);
 
             // LifeCycle lifeCycleObject = EntityUtil.getLifeCycle(lifeCycle);
             AbstractWorkflowEngine wfEngine = getWorkflowEngine();
@@ -494,10 +495,15 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
 
     private Pair<Date, Date> getStartAndEndDate(Entity entityObject, String startStr,
String endStr)
         throws FalconException {
+        return getStartAndEndDate(entityObject, startStr, endStr, Integer.parseInt(DEFAULT_NUM_RESULTS));
+    }
+
+    private Pair<Date, Date> getStartAndEndDate(Entity entityObject, String startStr,
String endStr, int numResults)
+        throws FalconException {
         Pair<Date, Date> clusterStartEndDates = EntityUtil.getEntityStartEndDates(entityObject);
         Frequency frequency = EntityUtil.getFrequency(entityObject);
-        Date endDate = getEndDate(startStr, endStr, clusterStartEndDates.second, frequency);
-        Date startDate = getStartDate(startStr, endDate, clusterStartEndDates.first, frequency);
+        Date endDate = getEndDate(startStr, endStr, clusterStartEndDates.second, frequency,
numResults);
+        Date startDate = getStartDate(startStr, endDate, clusterStartEndDates.first, frequency,
numResults);
 
         if (startDate.after(endDate)) {
             throw new FalconException("Specified End date " + SchemaHelper.getDateFormat().format(endDate)
@@ -507,12 +513,13 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
     }
 
     private Date getEndDate(String startStr, String endStr, Date clusterEndDate,
-                            Frequency frequency) throws FalconException {
+                            Frequency frequency, final int numResults) throws FalconException
{
         Date endDate;
         if (StringUtils.isEmpty(endStr)) {
             if (!StringUtils.isEmpty(startStr)) {
-                // set endDate to startDate + 10 times frequency
-                endDate = EntityUtil.getNextInstanceTime(EntityUtil.parseDateUTC(startStr),
frequency, null, 10);
+                // set endDate to startDate + numResults times frequency
+                endDate = EntityUtil.getNextInstanceTime(EntityUtil.parseDateUTC(startStr),
+                        frequency, null, numResults);
             } else {
                 // set endDate to currentTime
                 endDate = new Date();
@@ -526,12 +533,11 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
         return endDate;
     }
 
-    private Date getStartDate(String startStr, Date end,
-                              Date clusterStartDate, Frequency frequency) throws FalconException
{
+    private Date getStartDate(String startStr, Date end, Date clusterStartDate,
+                              Frequency frequency, final int dateMultiplier) throws FalconException
{
         Date start;
-        final int dateMultiplier = 10;
         if (StringUtils.isEmpty(startStr)) {
-            // set startDate to endDate - 10 times frequency
+            // set startDate to endDate - dateMultiplier times frequency
             long startMillis = end.getTime();
 
             switch (frequency.getTimeUnit().getCalendarUnit()){

http://git-wip-us.apache.org/repos/asf/falcon/blob/7532a586/prism/src/main/java/org/apache/falcon/resource/proxy/InstanceManagerProxy.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/resource/proxy/InstanceManagerProxy.java
b/prism/src/main/java/org/apache/falcon/resource/proxy/InstanceManagerProxy.java
index e304bd8..68219fb 100644
--- a/prism/src/main/java/org/apache/falcon/resource/proxy/InstanceManagerProxy.java
+++ b/prism/src/main/java/org/apache/falcon/resource/proxy/InstanceManagerProxy.java
@@ -45,7 +45,6 @@ import java.util.*;
  */
 @Path("instance")
 public class InstanceManagerProxy extends AbstractInstanceManager {
-    private static final String DEFAULT_NUM_RESULTS = "10";
     private final Map<String, Channel> processInstanceManagerChannels = new HashMap<String,
Channel>();
 
     public InstanceManagerProxy() {


Mime
View raw message