You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by vi...@apache.org on 2012/06/28 18:54:07 UTC
svn commit: r1355074 - in /incubator/oozie/trunk: ./
client/src/main/resources/ core/src/main/java/org/apache/oozie/action/hadoop/
core/src/test/java/org/apache/oozie/action/hadoop/
core/src/test/java/org/apache/oozie/service/
Author: virag
Date: Thu Jun 28 16:54:05 2012
New Revision: 1355074
URL: http://svn.apache.org/viewvc?rev=1355074&view=rev
Log:
OOZIE-861 allow for use of multiple <java-opts> (britt via virag)
Modified:
incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.4.xsd
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchemaService.java
incubator/oozie/trunk/release-log.txt
Modified: incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.4.xsd
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.4.xsd?rev=1355074&r1=1355073&r2=1355074&view=diff
==============================================================================
--- incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.4.xsd (original)
+++ incubator/oozie/trunk/client/src/main/resources/oozie-workflow-0.4.xsd Thu Jun 28 16:54:05 2012
@@ -193,7 +193,10 @@
<xs:element name="job-xml" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="configuration" type="workflow:CONFIGURATION" minOccurs="0" maxOccurs="1"/>
<xs:element name="main-class" type="xs:string" minOccurs="1" maxOccurs="1"/>
- <xs:element name="java-opts" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element name="java-opts" type="xs:string" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="java-opt" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:choice>
<xs:element name="arg" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="file" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="archive" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java?rev=1355074&r1=1355073&r2=1355074&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java Thu Jun 28 16:54:05 2012
@@ -538,6 +538,14 @@ public class JavaActionExecutor extends
}
LauncherMapper.setupMainArguments(launcherJobConf, args);
+ List<Element> javaopts = actionXml.getChildren("java-opt", ns);
+ for (Element opt: javaopts) {
+ String opts = launcherJobConf.get("mapred.child.java.opts", "");
+ opts = opts + " " + opt.getTextTrim();
+ opts = opts.trim();
+ launcherJobConf.set("mapred.child.java.opts", opts);
+ }
+
Element opt = actionXml.getChild("java-opts", ns);
if (opt != null) {
String opts = launcherJobConf.get("mapred.child.java.opts", "");
Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java?rev=1355074&r1=1355073&r2=1355074&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java Thu Jun 28 16:54:05 2012
@@ -868,4 +868,57 @@ public class TestJavaActionExecutor exte
actionConf.set("oozie.action.sharelib.for.java", "java-action-conf");
assertEquals("java-action-conf", ae.getShareLibName(context, new Element("java"), actionConf));
}
+
+ public void testJavaOpts() throws Exception {
+ String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>"
+ + getNameNodeUri() + "</name-node>" + "<job-xml>job.xml</job-xml>" + "<job-xml>job2.xml</job-xml>"
+ + "<configuration>" + "<property><name>oozie.launcher.a</name><value>LA</value></property>"
+ + "<property><name>a</name><value>AA</value></property>"
+ + "<property><name>b</name><value>BB</value></property>" + "</configuration>"
+ + "<main-class>MAIN-CLASS</main-class>" + "<java-opts>JAVA-OPT1 JAVA-OPT2</java-opts>"
+ + "<arg>A1</arg>" + "<arg>A2</arg>" + "<file>f.jar</file>" + "<archive>a.tar</archive>" + "</java>";
+
+ JavaActionExecutor ae = new JavaActionExecutor();
+
+ WorkflowJobBean wfBean = addRecordToWfJobTable("test1", actionXml);
+ WorkflowActionBean action = (WorkflowActionBean) wfBean.getActions().get(0);
+ action.setType(ae.getType());
+ action.setConf(actionXml);
+
+ Context context = new Context(wfBean, action);
+
+ Element actionXmlconf = XmlUtils.parseXml(action.getConf());
+
+ Configuration actionConf = ae.createBaseHadoopConf(context, actionXmlconf);
+
+ Configuration conf = ae.createLauncherConf(getFileSystem(), context, action, actionXmlconf, actionConf);
+
+ assertTrue(conf.get("mapred.child.java.opts").contains("JAVA-OPT1"));
+ assertTrue(conf.get("mapred.child.java.opts").contains("JAVA-OPT2"));
+
+ actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>"
+ + getNameNodeUri() + "</name-node>" + "<job-xml>job.xml</job-xml>" + "<job-xml>job2.xml</job-xml>"
+ + "<configuration>" + "<property><name>oozie.launcher.a</name><value>LA</value></property>"
+ + "<property><name>a</name><value>AA</value></property>"
+ + "<property><name>b</name><value>BB</value></property>" + "</configuration>"
+ + "<main-class>MAIN-CLASS</main-class>" + "<java-opt>JAVA-OPT1</java-opt>"
+ + "<java-opt>JAVA-OPT2</java-opt>" + "<arg>A1</arg>" + "<arg>A2</arg>" + "<file>f.jar</file>"
+ + "<archive>a.tar</archive>" + "</java>";
+
+ wfBean = addRecordToWfJobTable("test1", actionXml);
+ action = (WorkflowActionBean) wfBean.getActions().get(0);
+ action.setType(ae.getType());
+ action.setConf(actionXml);
+
+ context = new Context(wfBean, action);
+
+ actionXmlconf = XmlUtils.parseXml(action.getConf());
+
+ actionConf = ae.createBaseHadoopConf(context, actionXmlconf);
+
+ conf = ae.createLauncherConf(getFileSystem(), context, action, actionXmlconf, actionConf);
+
+ assertTrue(conf.get("mapred.child.java.opts").contains("JAVA-OPT1"));
+ assertTrue(conf.get("mapred.child.java.opts").contains("JAVA-OPT2"));
+ }
}
Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchemaService.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchemaService.java?rev=1355074&r1=1355073&r2=1355074&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchemaService.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchemaService.java Thu Jun 28 16:54:05 2012
@@ -92,6 +92,22 @@ public class TestSchemaService extends X
"<end name='end'/>" +
"</workflow-app>";
+ private static final String WF_4_MULTIPLE_JAVA_OPTS = "<workflow-app xmlns='uri:oozie:workflow:0.4' name ='app'>" +
+ "<start to='a'/>" +
+ "<action name='a'>" +
+ "<java>" +
+ "<job-tracker>JT</job-tracker>" +
+ "<name-node>NN</name-node>" +
+ "<main-class>main.java</main-class>" +
+ "<java-opt>-Dparam1=1</java-opt>" +
+ "<java-opt>-Dparam2=2</java-opt>" +
+ "</java>" +
+ "<ok to='end'/>" +
+ "<error to='end'/>" +
+ "</action>" +
+ "<end name='end'/>" +
+ "</workflow-app>";
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -114,6 +130,12 @@ public class TestSchemaService extends X
validator.validate(new StreamSource(new StringReader(APP1)));
}
+ public void testWfMultipleJavaOpts() throws Exception {
+ SchemaService wss = Services.get().get(SchemaService.class);
+ Validator validator = wss.getSchema(SchemaName.WORKFLOW).newValidator();
+ validator.validate(new StreamSource(new StringReader(WF_4_MULTIPLE_JAVA_OPTS)));
+ }
+
// Test for validation of workflow definition against pattern defined in schema to complete within 3 seconds
public void testWfSchemaFailure() throws Exception {
SchemaService wss = Services.get().get(SchemaService.class);
Modified: incubator/oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1355074&r1=1355073&r2=1355074&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Thu Jun 28 16:54:05 2012
@@ -1,5 +1,6 @@
-- Oozie 3.3.0 release (trunk - unreleased)
+OOZIE-861 allow for use of multiple <java-opts> (britt via virag)
OOZIE_870 Parameterize Credentials(britt via virag)
OOZIE_846 OozieClient iterates over Properties using Hashtable method (lars_francke via tucu)
OOZIE-875 Support for multiple job-xml elements in extension action nodes (rkanter via tucu)