falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject falcon git commit: FALCON-1702 Exception thrown by workflow status listeners on success notification. Contributed by Pallavi Rao.
Date Tue, 29 Dec 2015 20:56:21 GMT
Repository: falcon
Updated Branches:
  refs/heads/master ad9f2dea2 -> 5e34524fd


FALCON-1702 Exception thrown by workflow status listeners on success notification. Contributed
by Pallavi Rao.


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

Branch: refs/heads/master
Commit: 5e34524fd4712dc8979244b2283de7093cf1f5a7
Parents: ad9f2de
Author: Ajay Yadava <ajaynsit@gmail.com>
Authored: Wed Dec 30 02:13:04 2015 +0530
Committer: Ajay Yadava <ajaynsit@gmail.com>
Committed: Wed Dec 30 02:13:04 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../workflow/WorkflowExecutionContext.java      |  2 +-
 .../falcon/messaging/JMSMessageConsumer.java    | 25 ++++++++++++++++++--
 3 files changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/5e34524f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7ec8ce6..fe4216d 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -90,6 +90,8 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+    FALCON-1702 Exception thrown by workflow status listeners on success notification(Pallavi
Rao via Ajay Yadava)
+
     FALCON-1703 Falcon docs module not generating html files(Pallavi Rao via Ajay Yadava)
 
     FALCON-1565 Listing API non-intuitive response if time > endTime (Praveen Adlakha
via Ajay Yadava)

http://git-wip-us.apache.org/repos/asf/falcon/blob/5e34524f/common/src/main/java/org/apache/falcon/workflow/WorkflowExecutionContext.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/workflow/WorkflowExecutionContext.java
b/common/src/main/java/org/apache/falcon/workflow/WorkflowExecutionContext.java
index e51ad28..5866369 100644
--- a/common/src/main/java/org/apache/falcon/workflow/WorkflowExecutionContext.java
+++ b/common/src/main/java/org/apache/falcon/workflow/WorkflowExecutionContext.java
@@ -75,7 +75,7 @@ public class WorkflowExecutionContext {
      * Entity operations supported.
      */
     public enum EntityOperations {
-        GENERATE, DELETE, ARCHIVE, REPLICATE, CHMOD, IMPORT, EXPORT
+        GENERATE, DELETE, REPLICATE, IMPORT, EXPORT
     }
 
     public static final WorkflowExecutionArgs[] USER_MESSAGE_ARGS = {

http://git-wip-us.apache.org/repos/asf/falcon/blob/5e34524f/messaging/src/main/java/org/apache/falcon/messaging/JMSMessageConsumer.java
----------------------------------------------------------------------
diff --git a/messaging/src/main/java/org/apache/falcon/messaging/JMSMessageConsumer.java b/messaging/src/main/java/org/apache/falcon/messaging/JMSMessageConsumer.java
index bbb5d9b..2380e47 100644
--- a/messaging/src/main/java/org/apache/falcon/messaging/JMSMessageConsumer.java
+++ b/messaging/src/main/java/org/apache/falcon/messaging/JMSMessageConsumer.java
@@ -21,6 +21,7 @@ package org.apache.falcon.messaging;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.falcon.FalconException;
 import org.apache.falcon.Pair;
+import org.apache.falcon.Tag;
 import org.apache.falcon.aspect.GenericAlert;
 import org.apache.falcon.entity.WorkflowNameBuilder;
 import org.apache.falcon.entity.v0.EntityType;
@@ -146,11 +147,12 @@ public class JMSMessageConsumer implements MessageListener, ExceptionListener
{
                 wfProperties.put(WorkflowExecutionArgs.NOMINAL_TIME,
                         getNominalTimeString(Long.parseLong(json.getString("nominalTime"))));
             }
-            Pair<String, EntityType> entityTypePair = WorkflowNameBuilder.WorkflowName.getEntityNameAndType(
-                    message.getStringProperty("appName"));
+            String appName = message.getStringProperty("appName");
+            Pair<String, EntityType> entityTypePair = WorkflowNameBuilder.WorkflowName.getEntityNameAndType(appName);
             wfProperties.put(WorkflowExecutionArgs.ENTITY_NAME, entityTypePair.first);
             wfProperties.put(WorkflowExecutionArgs.ENTITY_TYPE, entityTypePair.second.name());
             wfProperties.put(WorkflowExecutionArgs.WORKFLOW_USER, message.getStringProperty("user"));
+            wfProperties.put(WorkflowExecutionArgs.OPERATION, getOperation(appName).name());
 
             String appType = message.getStringProperty("appType");
             return WorkflowExecutionContext.create(wfProperties, WorkflowExecutionContext.Type.valueOf(appType));
@@ -160,6 +162,25 @@ public class JMSMessageConsumer implements MessageListener, ExceptionListener
{
         }
     }
 
+    // Retrieves EntityOperation from the workflow name
+    private WorkflowExecutionContext.EntityOperations getOperation(String appName) {
+        Tag tag = WorkflowNameBuilder.WorkflowName.getTagAndSuffixes(appName).first;
+        switch(tag) {
+        case REPLICATION:
+            return WorkflowExecutionContext.EntityOperations.REPLICATE;
+        case RETENTION:
+            return WorkflowExecutionContext.EntityOperations.DELETE;
+        case IMPORT:
+            return WorkflowExecutionContext.EntityOperations.IMPORT;
+        case EXPORT:
+            return WorkflowExecutionContext.EntityOperations.EXPORT;
+        case DEFAULT:
+            return WorkflowExecutionContext.EntityOperations.GENERATE;
+        default:
+            throw new IllegalArgumentException("Invalid tag - " + tag);
+        }
+    }
+
     private String getNominalTimeString(long timeInMillis) {
         Date time = new Date(timeInMillis);
         final String format = "yyyy-MM-dd-HH-mm";


Mime
View raw message