falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suh...@apache.org
Subject falcon git commit: FALCON-987 params command inconsistent behavior. Contributed by pavan kumar kolamuri
Date Thu, 05 Mar 2015 09:43:41 GMT
Repository: falcon
Updated Branches:
  refs/heads/master 8fa2c49fd -> ac8b7aaa9


FALCON-987 params command inconsistent behavior. Contributed by pavan kumar kolamuri


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

Branch: refs/heads/master
Commit: ac8b7aaa97480bd58a2bb73bbdd2b0cc13aca946
Parents: 8fa2c49
Author: Suhas Vasu <suhas.v@inmobi.com>
Authored: Thu Mar 5 15:13:14 2015 +0530
Committer: Suhas Vasu <suhas.v@inmobi.com>
Committed: Thu Mar 5 15:13:14 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                               |  3 +++
 client/src/main/java/org/apache/falcon/cli/FalconCLI.java |  3 ++-
 .../main/java/org/apache/falcon/entity/EntityUtil.java    | 10 ++++++++++
 docs/src/site/twiki/FalconCLI.twiki                       |  2 +-
 .../apache/falcon/resource/AbstractInstanceManager.java   |  6 ++++--
 5 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/ac8b7aaa/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a2a54bf..0de4226 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -78,6 +78,9 @@ Trunk (Unreleased)
    Seetharam)
 
   OPTIMIZATIONS
+   FALCON-987 params command inconsistent behavior
+   (pavan kumar kolamuri via Suhas Vasu)
+
    FALCON-944 Parallel update APIs create 2 coords (Suhas Vasu)
 
    FALCON-943 process update copying user lib is very slow. (Shwetha G S)

http://git-wip-us.apache.org/repos/asf/falcon/blob/ac8b7aaa/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/cli/FalconCLI.java b/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
index 92b5347..869d56c 100644
--- a/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
+++ b/client/src/main/java/org/apache/falcon/cli/FalconCLI.java
@@ -746,7 +746,8 @@ public class FalconCLI {
         Option params = new Option(
                 PARARMS_OPT,
                 false,
-                "Displays the workflow parameters for a given instance of specified nominal
time");
+                "Displays the workflow parameters for a given instance of specified nominal
time"
+                        + "start time represents nominal time and end time is not considered");
 
         Option listing = new Option(
                 LISTING_OPT,

http://git-wip-us.apache.org/repos/asf/falcon/blob/ac8b7aaa/common/src/main/java/org/apache/falcon/entity/EntityUtil.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/entity/EntityUtil.java b/common/src/main/java/org/apache/falcon/entity/EntityUtil.java
index febbe50..dbeba26 100644
--- a/common/src/main/java/org/apache/falcon/entity/EntityUtil.java
+++ b/common/src/main/java/org/apache/falcon/entity/EntityUtil.java
@@ -317,6 +317,16 @@ public final class EntityUtil {
         return count + 1;
     }
 
+    public static Date getNextInstanceTime(Date instanceTime, Frequency frequency, TimeZone
tz) {
+        Calendar insCal = Calendar.getInstance(tz);
+        insCal.setTime(instanceTime);
+
+        final int freq = frequency.getFrequencyAsInt();
+        insCal.add(frequency.getTimeUnit().getCalendarUnit(), freq);
+
+        return insCal.getTime();
+    }
+
     public static String md5(Entity entity) throws FalconException {
         return new String(Hex.encodeHex(DigestUtils.md5(stringOf(entity))));
     }

http://git-wip-us.apache.org/repos/asf/falcon/blob/ac8b7aaa/docs/src/site/twiki/FalconCLI.twiki
----------------------------------------------------------------------
diff --git a/docs/src/site/twiki/FalconCLI.twiki b/docs/src/site/twiki/FalconCLI.twiki
index d503d22..64e96d3 100644
--- a/docs/src/site/twiki/FalconCLI.twiki
+++ b/docs/src/site/twiki/FalconCLI.twiki
@@ -258,7 +258,7 @@ $FALCON_HOME/bin/falcon instance -type <<feed/process>> -name
<<name>> -status -
 
 ---+++Params
 
-Displays the workflow params of a given instance. Where start time is considered as nominal
time of that instance.
+Displays the workflow params of a given instance. Where start time is considered as nominal
time of that instance and end time won't be considered.
 
 Usage:
 $FALCON_HOME/bin/falcon instance -type <<feed/process>> -name <<name>>
-params -start "yyyy-MM-dd'T'HH:mm'Z'"

http://git-wip-us.apache.org/repos/asf/falcon/blob/ac8b7aaa/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 f9f41d3..caf623b 100644
--- a/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
+++ b/prism/src/main/java/org/apache/falcon/resource/AbstractInstanceManager.java
@@ -365,9 +365,11 @@ public abstract class AbstractInstanceManager extends AbstractEntityManager
{
             validateParams(type, entity);
             Entity entityObject = EntityUtil.getEntity(type, entity);
             Pair<Date, Date> startAndEndDate = getStartAndEndDate(entityObject, startTime,
null);
-
+            Date start = startAndEndDate.first;
+            Date end = EntityUtil.getNextInstanceTime(start, EntityUtil.getFrequency(entityObject),
+                    EntityUtil.getTimeZone(entityObject));
             AbstractWorkflowEngine wfEngine = getWorkflowEngine();
-            return wfEngine.getInstanceParams(entityObject, startAndEndDate.first, startAndEndDate.second,
lifeCycles);
+            return wfEngine.getInstanceParams(entityObject, start, end, lifeCycles);
         } catch (Throwable e) {
             LOG.error("Failed to display params of an instance", e);
             throw FalconWebException.newInstanceException(e, Response.Status.BAD_REQUEST);


Mime
View raw message