Repository: oozie
Updated Branches:
  refs/heads/master 00275b71a -> 24289edc6


OOZIE-2661 Coordinator Action status not updated when workflow job SUSPENDED


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

Branch: refs/heads/master
Commit: 24289edc620c635c56cc75a43c614f98e63f1102
Parents: 00275b7
Author: Purshotam Shah <purus...@yahoo-inc.com>
Authored: Wed Sep 21 09:25:09 2016 -0700
Committer: Purshotam Shah <purus...@yahoo-inc.com>
Committed: Wed Sep 21 09:25:09 2016 -0700

----------------------------------------------------------------------
 .../command/coord/CoordActionCheckXCommand.java  |  8 +++++++-
 .../apache/oozie/event/TestEventGeneration.java  | 19 +++++++++++++++++++
 release-log.txt                                  |  1 +
 3 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/24289edc/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
 
b/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
index bdbbd24..cdad69e 100644
--- 
a/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
+++ 
b/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
@@ -107,6 +107,12 @@ public class CoordActionCheckXCommand extends 
CoordinatorXCommand<Void> {
                         // set pending to false as the status is KILLED
                         coordAction.setPending(0);
                     }
+                    else if (workflowJob.getStatus() == 
WorkflowJob.Status.SUSPENDED) {
+                        
coordAction.setStatus(CoordinatorAction.Status.SUSPENDED);
+                        slaStatus = Status.FAILED;
+                        // set pending to false as the status is SUSPENDED
+                        coordAction.setPending(0);
+                    }
                     else {
                         LOG.warn("Unexpected workflow " + workflowJob.getId() 
+ " STATUS " + workflowJob.getStatus());
                         coordAction.setLastModifiedTime(new Date());
@@ -150,7 +156,7 @@ public class CoordActionCheckXCommand extends 
CoordinatorXCommand<Void> {
      */
     @Override
     public String getEntityKey() {
-        return actionId;
+        return actionId.substring(0, actionId.indexOf("@"));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/oozie/blob/24289edc/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java 
b/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java
index afd3f8f..59d0420 100644
--- a/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java
+++ b/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java
@@ -314,6 +314,25 @@ public class TestEventGeneration extends XDataTestCase {
         assertEquals(coord.getUser(), event.getUser());
         assertEquals(coord.getAppName(), event.getAppName());
 
+        // Action Suspended
+        wfJob.setStatus(WorkflowJob.Status.SUSPENDED);
+        action.setStatus(CoordinatorAction.Status.RUNNING);
+        
CoordActionQueryExecutor.getInstance().executeUpdate(CoordActionQuery.UPDATE_COORD_ACTION_STATUS_PENDING_TIME,
+                action);
+        
WorkflowJobQueryExecutor.getInstance().executeUpdate(WorkflowJobQuery.UPDATE_WORKFLOW_STATUS_MODTIME,
 wfJob);
+        new CoordActionCheckXCommand(action.getId(), 0).call();
+        action = jpaService.execute(coordGetCmd);
+        assertEquals(CoordinatorAction.Status.SUSPENDED, action.getStatus());
+        event = (JobEvent) queue.poll();
+        assertEquals(EventStatus.SUSPEND, event.getEventStatus());
+        assertEquals(AppType.COORDINATOR_ACTION, event.getAppType());
+        assertEquals(action.getId(), event.getId());
+        assertEquals(action.getJobId(), event.getParentId());
+        assertEquals(action.getNominalTime(), ((CoordinatorActionEvent) 
event).getNominalTime());
+        assertEquals(wfJob.getStartTime(), event.getStartTime());
+        assertEquals(coord.getUser(), event.getUser());
+        assertEquals(coord.getAppName(), event.getAppName());
+
         // Action start on Coord Resume
         coord.setStatus(CoordinatorJobBean.Status.SUSPENDED);
         
CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_STATUS,
 coord);

http://git-wip-us.apache.org/repos/asf/oozie/blob/24289edc/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 71d9dfe..568fc3f 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.3.0 release (trunk - unreleased)
 
+OOZIE-2661 Coordinator Action status not updated when workflow job SUSPENDED 
(satishsaley via puru)
 OOZIE-2273 MiniOozie does not work outside of Oozie (rkanter)
 OOZIE-2667 Optimize queries for DB export (gezapeti via rkanter)
 OOZIE-1793 Improve find bugs reporting for Oozie (rkanter)

Reply via email to