Repository: falcon
Updated Branches:
  refs/heads/master f008f867f -> b921247c3


FALCON-1339 List feed entities shows scheduled Feed entities as submitted. 
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/b921247c
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/b921247c
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/b921247c

Branch: refs/heads/master
Commit: b921247c3b115c430132f416d3fac5ef7f24c8b4
Parents: f008f86
Author: Sowmya Ramesh <[email protected]>
Authored: Mon Oct 5 16:01:04 2015 -0700
Committer: Sowmya Ramesh <[email protected]>
Committed: Mon Oct 5 16:01:04 2015 -0700

----------------------------------------------------------------------
 CHANGES.txt                                         |  2 ++
 .../oozie/feed/FeedRetentionCoordinatorBuilder.java | 16 ++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/b921247c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7cc3efb..9d584c7 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -49,6 +49,8 @@ Trunk (Unreleased)
     FALCON-1403 Revisit IT cleanup and teardown(Narayan Periwal via Pallavi 
Rao)
 
   BUG FIXES
+    FALCON-1339 List feed entities shows scheduled Feed entities as 
submitted(Balu Vellanki via Sowmya Ramesh)
+
     FALCON-1499 Lifecycle Retention Issues(Ajay Yadava)
 
     FALCON-1469 Flaky 
EntityManagerJerseyIT#testDuplicateSubmitCommands(Sandeep Samudrala via Ajay 
Yadava)

http://git-wip-us.apache.org/repos/asf/falcon/blob/b921247c/oozie/src/main/java/org/apache/falcon/oozie/feed/FeedRetentionCoordinatorBuilder.java
----------------------------------------------------------------------
diff --git 
a/oozie/src/main/java/org/apache/falcon/oozie/feed/FeedRetentionCoordinatorBuilder.java
 
b/oozie/src/main/java/org/apache/falcon/oozie/feed/FeedRetentionCoordinatorBuilder.java
index a4b5f35..0809bb6 100644
--- 
a/oozie/src/main/java/org/apache/falcon/oozie/feed/FeedRetentionCoordinatorBuilder.java
+++ 
b/oozie/src/main/java/org/apache/falcon/oozie/feed/FeedRetentionCoordinatorBuilder.java
@@ -18,6 +18,7 @@
 
 package org.apache.falcon.oozie.feed;
 
+import org.apache.commons.lang3.time.DateUtils;
 import org.apache.falcon.FalconException;
 import org.apache.falcon.LifeCycle;
 import org.apache.falcon.Tag;
@@ -50,18 +51,21 @@ public class FeedRetentionCoordinatorBuilder extends 
OozieCoordinatorBuilder<Fee
 
     @Override public List<Properties> buildCoords(Cluster cluster, Path 
buildPath) throws FalconException {
         org.apache.falcon.entity.v0.feed.Cluster feedCluster = 
FeedHelper.getCluster(entity, cluster.getName());
-
-        if (feedCluster.getValidity().getEnd().before(new Date())) {
-            LOG.warn("Feed Retention is not applicable as Feed's end time for 
cluster {} is not in the future",
-                cluster.getName());
+        if (feedCluster == null) {
             return null;
         }
 
         COORDINATORAPP coord = new COORDINATORAPP();
         String coordName = getEntityName();
         coord.setName(coordName);
-        
coord.setEnd(SchemaHelper.formatDateUTC(feedCluster.getValidity().getEnd()));
-        coord.setStart(SchemaHelper.formatDateUTC(new Date()));
+        Date endDate = feedCluster.getValidity().getEnd();
+        coord.setEnd(SchemaHelper.formatDateUTC(endDate));
+        if (feedCluster.getValidity().getEnd().before(new Date())) {
+            Date startDate = DateUtils.addMinutes(endDate, -1);
+            coord.setStart(SchemaHelper.formatDateUTC(startDate));
+        } else {
+            coord.setStart(SchemaHelper.formatDateUTC(new Date()));
+        }
         coord.setTimezone(entity.getTimezone().getID());
         TimeUnit timeUnit = entity.getFrequency().getTimeUnit();
         if (timeUnit == TimeUnit.hours || timeUnit == TimeUnit.minutes) {

Reply via email to