You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by pb...@apache.org on 2017/12/08 11:52:10 UTC
oozie git commit: OOZIE-3139 Oozie validates workflow incorrectly
(dionusos via pbacsko)
Repository: oozie
Updated Branches:
refs/heads/master fe3dc9cd0 -> a7f7e083d
OOZIE-3139 Oozie validates workflow incorrectly (dionusos via pbacsko)
Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/a7f7e083
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/a7f7e083
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/a7f7e083
Branch: refs/heads/master
Commit: a7f7e083d029e71a5fe8a19a0bddf0ee8f7b85df
Parents: fe3dc9c
Author: Peter Bacsko <pb...@cloudera.com>
Authored: Fri Dec 8 12:52:00 2017 +0100
Committer: Peter Bacsko <pb...@cloudera.com>
Committed: Fri Dec 8 12:52:00 2017 +0100
----------------------------------------------------------------------
.../workflow/lite/LiteWorkflowValidator.java | 2 +-
.../lite/TestLiteWorkflowAppParser.java | 29 +++++++
core/src/test/resources/wf-kill-with-ok.xml | 57 +++++++++++++
.../test/resources/wf-multiple-error-parent.xml | 84 ++++++++++++++++++++
release-log.txt | 1 +
5 files changed, 172 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oozie/blob/a7f7e083/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowValidator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowValidator.java b/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowValidator.java
index 24c05af..c7f2f49 100644
--- a/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowValidator.java
+++ b/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowValidator.java
@@ -264,7 +264,7 @@ public class LiteWorkflowValidator {
} else if (node instanceof ActionNodeDef) {
String transition = node.getTransitions().get(0); // "ok to" transition
NodeDef okNode = app.getNode(transition);
- validateForkJoin(app, okNode, currentFork, topDecisionParent, true, path, forkJoins, nodeAndDecisionParents);
+ validateForkJoin(app, okNode, currentFork, topDecisionParent, okPath, path, forkJoins, nodeAndDecisionParents);
transition = node.getTransitions().get(1); // "error to" transition
NodeDef errorNode = app.getNode(transition);
http://git-wip-us.apache.org/repos/asf/oozie/blob/a7f7e083/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java b/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java
index 680f4b4..2cdbde4 100644
--- a/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java
+++ b/core/src/test/java/org/apache/oozie/workflow/lite/TestLiteWorkflowAppParser.java
@@ -19,6 +19,7 @@
package org.apache.oozie.workflow.lite;
+import java.io.IOException;
import java.io.StringReader;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -40,6 +41,7 @@ import org.apache.oozie.workflow.lite.TestLiteWorkflowLib.TestActionNodeHandler;
import org.apache.oozie.workflow.lite.TestLiteWorkflowLib.TestDecisionNodeHandler;
import org.jdom.Element;
import org.jdom.Namespace;
+import org.junit.Assert;
public class TestLiteWorkflowAppParser extends XTestCase {
public static String dummyConf = "<java></java>";
@@ -1497,6 +1499,33 @@ public class TestLiteWorkflowAppParser extends XTestCase {
assertFalse("Workflow validation failed", failure.get());
}
+ public void testMultipleErrorTransitions() throws WorkflowException, IOException {
+ LiteWorkflowAppParser parser = new LiteWorkflowAppParser(null,
+ LiteWorkflowStoreService.LiteControlNodeHandler.class,
+ LiteWorkflowStoreService.LiteDecisionHandler.class, LiteWorkflowStoreService.LiteActionHandler.class);
+ try {
+ parser.validateAndParse(IOUtils.getResourceAsReader(
+ "wf-multiple-error-parent.xml", -1), new Configuration());
+ } catch (final WorkflowException e) {
+ e.printStackTrace();
+ Assert.fail("This workflow has to be correct.");
+ }
+ }
+
+ public void testOkToTransitionToKillTransitions() throws WorkflowException, IOException {
+ LiteWorkflowAppParser parser = new LiteWorkflowAppParser(null,
+ LiteWorkflowStoreService.LiteControlNodeHandler.class,
+ LiteWorkflowStoreService.LiteDecisionHandler.class, LiteWorkflowStoreService.LiteActionHandler.class);
+ try {
+
+ parser.validateAndParse(IOUtils.getResourceAsReader(
+ "wf-kill-with-ok.xml", -1), new Configuration());
+ } catch (final WorkflowException e) {
+ e.printStackTrace();
+ Assert.fail("This workflow has to be correct.");
+ }
+ }
+
private void invokeForkJoin(LiteWorkflowAppParser parser, LiteWorkflowApp def) throws WorkflowException {
LiteWorkflowValidator validator = new LiteWorkflowValidator();
validator.validateWorkflow(def, true);
http://git-wip-us.apache.org/repos/asf/oozie/blob/a7f7e083/core/src/test/resources/wf-kill-with-ok.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/wf-kill-with-ok.xml b/core/src/test/resources/wf-kill-with-ok.xml
new file mode 100644
index 0000000..9df0ef5
--- /dev/null
+++ b/core/src/test/resources/wf-kill-with-ok.xml
@@ -0,0 +1,57 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<workflow-app xmlns="uri:oozie:workflow:0.5" name="test-wf">
+ <start to="f1"/>
+
+ <action name="f1">
+ <fs>
+ <mkdir path='/tmp'/>
+ </fs>
+ <ok to="f1a1"/>
+ <error to="f1a1"/>
+ </action>
+
+ <action name="f1a1">
+ <fs>
+ <mkdir path='/tmp'/>
+ </fs>
+ <ok to="f1a2"/>
+ <error to="f1a3"/>
+ </action>
+
+ <action name="f1a2">
+ <fs>
+ <mkdir path='/tmp'/>
+ </fs>
+ <ok to="z"/>
+ <error to="b"/>
+ </action>
+
+ <action name="f1a3">
+ <fs>
+ <mkdir path='/tmp'/>
+ </fs>
+ <ok to="b"/>
+ <error to="b"/>
+ </action>
+
+ <kill name="b">
+ <message>kill</message>
+ </kill>
+ <end name="z"/>
+</workflow-app>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oozie/blob/a7f7e083/core/src/test/resources/wf-multiple-error-parent.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/wf-multiple-error-parent.xml b/core/src/test/resources/wf-multiple-error-parent.xml
new file mode 100644
index 0000000..e367791
--- /dev/null
+++ b/core/src/test/resources/wf-multiple-error-parent.xml
@@ -0,0 +1,84 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<workflow-app xmlns="uri:oozie:workflow:0.4" name="shell-fork-wf">
+ <start to="fork"/>
+ <fork name="fork">
+ <path start="FA"/>
+ <path start="FB"/>
+ </fork>
+ <action name="FA">
+ <shell xmlns="uri:oozie:shell-action:0.2">
+ <job-tracker>${jobTracker}</job-tracker>
+ <name-node>${nameNode}</name-node>
+ <exec>${myscript}</exec>
+ <file>${myscriptPath}</file>
+ <capture-output/>
+ </shell>
+ <ok to="join"/>
+ <error to="D"/>
+ </action>
+ <action name="FB">
+ <shell xmlns="uri:oozie:shell-action:0.2">
+ <job-tracker>${jobTracker}</job-tracker>
+ <name-node>${nameNode}</name-node>
+ <exec>${myscript}</exec>
+ <file>${myscriptPath}</file>
+ <capture-output/>
+ </shell>
+ <ok to="join"/>
+ <error to="D"/>
+ </action>
+ <join name="join" to="C" />
+ <action name="C">
+ <shell xmlns="uri:oozie:shell-action:0.2">
+ <job-tracker>${jobTracker}</job-tracker>
+ <name-node>${nameNode}</name-node>
+ <exec>${myscript}</exec>
+ <file>${myscriptPath}</file>
+ <capture-output/>
+ </shell>
+ <ok to="end"/>
+ <error to="D"/>
+ </action>
+ <action name="D">
+ <shell xmlns="uri:oozie:shell-action:0.2">
+ <job-tracker>${jobTracker}</job-tracker>
+ <name-node>${nameNode}</name-node>
+ <exec>${myscript}</exec>
+ <file>${myscriptPath}</file>
+ <capture-output/>
+ </shell>
+ <ok to="E"/>
+ <error to="fail"/>
+ </action>
+ <action name="E">
+ <shell xmlns="uri:oozie:shell-action:0.2">
+ <job-tracker>${jobTracker}</job-tracker>
+ <name-node>${nameNode}</name-node>
+ <exec>${myscript}</exec>
+ <file>${myscriptPath}</file>
+ <capture-output/>
+ </shell>
+ <ok to="fail"/>
+ <error to="fail"/>
+ </action>
+ <kill name="fail">
+ <message>Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
+ </kill>
+ <end name="end"/>
+</workflow-app>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oozie/blob/a7f7e083/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 6d2181d..53eef6b 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
-- Oozie 5.0.0 release (trunk - unreleased)
+OOZIE-3139 Oozie validates workflow incorrectly (dionusos via pbacsko)
OOZIE-2869 amend Ability to add/remove MapReduce jars from action classpath (andras.piros)
OOZIE-2969 Drop support for Java 1.7 (dbist13 via gezapeti, pbacsko)
OOZIE-2681 Fix javadoc to compile on JDK8 (dbist13, abhisekbafna, gezapeti)