Repository: oozie
Updated Branches:
  refs/heads/master 22b51b0b3 -> 1cb67fd6b


OOZIE-3378 [core] Coordinator action's status is SUBMITTED after E1003 error 
(asalamon74 via andras.piros)


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

Branch: refs/heads/master
Commit: 1cb67fd6b5726128fcf1a751ff236a4c794bb8a4
Parents: 22b51b0
Author: Andras Piros <andras.pi...@cloudera.com>
Authored: Tue Nov 6 12:29:30 2018 +0100
Committer: Andras Piros <andras.pi...@cloudera.com>
Committed: Tue Nov 6 12:29:30 2018 +0100

----------------------------------------------------------------------
 .../command/coord/CoordActionStartXCommand.java | 15 ++++----
 .../coord/TestCoordActionStartXCommand.java     | 38 ++++++++++++++++++++
 release-log.txt                                 |  1 +
 3 files changed, 47 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/1cb67fd6/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
 
b/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
index 267943e..9b434b7 100644
--- 
a/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
+++ 
b/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
@@ -192,14 +192,15 @@ public class CoordActionStartXCommand extends 
CoordinatorXCommand<Void> {
 
         log.debug("actionid=" + actionId + ", status=" + 
coordAction.getStatus());
         if (coordAction.getStatus() == CoordinatorAction.Status.SUBMITTED) {
-            // log.debug("getting.. job id: " + coordAction.getJobId());
-            // create merged runConf to pass to WF Engine
-            Configuration runConf = mergeConfig(coordAction);
-            coordAction.setRunConf(XmlUtils.prettyPrint(runConf).toString());
-            // log.debug("%%% merged runconf=" +
-            // XmlUtils.prettyPrint(runConf).toString());
-            DagEngine dagEngine = 
Services.get().get(DagEngineService.class).getDagEngine(user);
             try {
+                // log.debug("getting.. job id: " + coordAction.getJobId());
+                // create merged runConf to pass to WF Engine
+                Configuration runConf = mergeConfig(coordAction);
+                
coordAction.setRunConf(XmlUtils.prettyPrint(runConf).toString());
+                // log.debug("%%% merged runconf=" +
+                // XmlUtils.prettyPrint(runConf).toString());
+                DagEngine dagEngine = 
Services.get().get(DagEngineService.class).getDagEngine(user);
+
                 Configuration conf = new XConfiguration(new 
StringReader(coordAction.getRunConf()));
                 SLAEventBean slaEvent = 
SLADbOperations.createStatusEvent(coordAction.getSlaXml(), coordAction.getId(),
                         Status.STARTED,

http://git-wip-us.apache.org/repos/asf/oozie/blob/1cb67fd6/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionStartXCommand.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionStartXCommand.java
 
b/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionStartXCommand.java
index 4215a32..0cbb7b1 100644
--- 
a/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionStartXCommand.java
+++ 
b/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionStartXCommand.java
@@ -29,7 +29,9 @@ import java.io.PrintWriter;
 import java.io.Reader;
 import java.io.Writer;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 
 import org.apache.hadoop.conf.Configuration;
@@ -117,6 +119,29 @@ public class TestCoordActionStartXCommand extends 
XDataTestCase {
     }
 
     /**
+     * Coord action XML contains disallowed property change and
+     * test that CoordActionStartXCommand stores error code and error message 
in
+     * action's table during error handling
+     *
+     * @throws IOException
+     * @throws JPAExecutorException
+     * @throws CommandException
+     */
+    public void testActionStartWithError1003Reported() throws IOException, 
JPAExecutorException, CommandException {
+        String actionId = new Date().getTime() + 
"-COORD-ActionStartCommand-C@1";
+        String wfApp = "<start to='${someParam}' />";
+        Map<String, String> additionalProperties = new HashMap<>();
+        additionalProperties.put("user.name", "admin");
+        addRecordToActionTable(actionId, 1, wfApp, additionalProperties);
+        new CoordActionStartXCommand(actionId, "test", "myapp", 
"myjob").call();
+        final JPAService jpaService = Services.get().get(JPAService.class);
+        CoordinatorActionBean action = jpaService.execute(new 
CoordActionGetForStartJPAExecutor(actionId));
+        assertEquals("Expected status was FAILED due to E1003 error code", 
CoordinatorAction.Status.FAILED, action.getStatus());
+        assertEquals(action.getErrorCode(), ErrorCode.E1003.toString());
+        assertTrue(action.getErrorMessage().contains("Invalid coordinator 
application attributes"));
+    }
+
+    /**
      * Test : configuration contains url string which should be escaped before 
put into the evaluator.
      * If not escape, the error 'SAXParseException' will be thrown and 
workflow job will not be submitted.
      *
@@ -211,6 +236,11 @@ public class TestCoordActionStartXCommand extends 
XDataTestCase {
 
     private void addRecordToActionTable(String actionId, int actionNum, String 
wfParam)
             throws IOException, JPAExecutorException {
+        addRecordToActionTable(actionId, actionNum, wfParam, null);
+    }
+
+    private void addRecordToActionTable(String actionId, int actionNum, String 
wfParam, Map<String, String> additionalProperties)
+            throws IOException, JPAExecutorException {
         final JPAService jpaService = Services.get().get(JPAService.class);
         CoordinatorActionBean action = new CoordinatorActionBean();
         action.setJobId(actionId);
@@ -257,6 +287,14 @@ public class TestCoordActionStartXCommand extends 
XDataTestCase {
         actionXml += "<name>inputB</name>";
         actionXml += "<value>" + getTestCaseFileUri("coord/US//2009/02/01") + 
"</value>";
         actionXml += "</property>";
+        if (additionalProperties != null) {
+            for (Map.Entry<String, String> entry : 
additionalProperties.entrySet()) {
+                actionXml += "<property>";
+                actionXml += "<name>" + entry.getKey() + "</name>";
+                actionXml += "<value>" + entry.getValue() + "</value>";
+                actionXml += "</property>";
+            }
+        }
         actionXml += "</configuration>";
         actionXml += "</workflow>";
         String slaXml = " <sla:info xmlns:sla='uri:oozie:sla:0.1'>" + " 
<sla:app-name>test-app</sla:app-name>"

http://git-wip-us.apache.org/repos/asf/oozie/blob/1cb67fd6/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index d8561d3..47e6f27 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 5.2.0 release (trunk - unreleased)
 
+OOZIE-3378 [core] Coordinator action's status is SUBMITTED after E1003 error 
(asalamon74 via andras.piros)
 OOZIE-3373 [core] Logging of lock information is inconsistent (Prabhu Joseph 
via andras.piros)
 OOZIE-3371 TestSubWorkflowActionExecutor#testSubWorkflowRerun() is flaky 
(andras.piros)
 OOZIE-3365 Workflow and coordinator action status remains RUNNING after rerun 
(satishsaley)

Reply via email to