Author: rkanter
Date: Tue May 21 21:35:43 2013
New Revision: 1484974
URL: http://svn.apache.org/r1484974
Log:
OOZIE-1387 Proxysubmission from the Oozie client doesn't allow the mapreduce
API (rkanter)
Modified:
oozie/trunk/client/src/main/java/org/apache/oozie/cli/OozieCLI.java
oozie/trunk/core/src/test/java/org/apache/oozie/client/TestOozieCLI.java
oozie/trunk/release-log.txt
Modified: oozie/trunk/client/src/main/java/org/apache/oozie/cli/OozieCLI.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/client/src/main/java/org/apache/oozie/cli/OozieCLI.java?rev=1484974&r1=1484973&r2=1484974&view=diff
==============================================================================
--- oozie/trunk/client/src/main/java/org/apache/oozie/cli/OozieCLI.java
(original)
+++ oozie/trunk/client/src/main/java/org/apache/oozie/cli/OozieCLI.java Tue May
21 21:35:43 2013
@@ -154,7 +154,9 @@ public class OozieCLI {
private static final String INSTANCE_SEPARATOR = "#";
private static final String MAPRED_MAPPER = "mapred.mapper.class";
+ private static final String MAPRED_MAPPER_2 = "mapreduce.map.class";
private static final String MAPRED_REDUCER = "mapred.reducer.class";
+ private static final String MAPRED_REDUCER_2 = "mapreduce.reduce.class";
private static final String MAPRED_INPUT = "mapred.input.dir";
private static final String MAPRED_OUTPUT = "mapred.output.dir";
@@ -1658,24 +1660,25 @@ public class OozieCLI {
XOozieClient wc = createXOozieClient(commandLine);
Properties conf = getConfiguration(wc, commandLine);
- String mapper = conf.getProperty(MAPRED_MAPPER);
+ String mapper = conf.getProperty(MAPRED_MAPPER,
conf.getProperty(MAPRED_MAPPER_2));
if (mapper == null) {
- throw new OozieCLIException("mapper is not specified in conf");
+ throw new OozieCLIException("mapper (" + MAPRED_MAPPER + " or
" + MAPRED_MAPPER_2 + ") must be specified in conf");
}
- String reducer = conf.getProperty(MAPRED_REDUCER);
+ String reducer = conf.getProperty(MAPRED_REDUCER,
conf.getProperty(MAPRED_REDUCER_2));
if (reducer == null) {
- throw new OozieCLIException("reducer is not specified in
conf");
+ throw new OozieCLIException("reducer (" + MAPRED_REDUCER + "
or " + MAPRED_REDUCER_2
+ + ") must be specified in conf");
}
String inputDir = conf.getProperty(MAPRED_INPUT);
if (inputDir == null) {
- throw new OozieCLIException("mapred.input.dir is not specified
in conf");
+ throw new OozieCLIException("input dir (" + MAPRED_INPUT +")
must be specified in conf");
}
String outputDir = conf.getProperty(MAPRED_OUTPUT);
if (outputDir == null) {
- throw new OozieCLIException("mapred.output.dir is not
specified in conf");
+ throw new OozieCLIException("output dir (" + MAPRED_OUTPUT +")
must be specified in conf");
}
System.out.println(JOB_ID_PREFIX + wc.submitMapReduce(conf));
Modified:
oozie/trunk/core/src/test/java/org/apache/oozie/client/TestOozieCLI.java
URL:
http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/client/TestOozieCLI.java?rev=1484974&r1=1484973&r2=1484974&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/client/TestOozieCLI.java
(original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/client/TestOozieCLI.java
Tue May 21 21:35:43 2013
@@ -124,7 +124,7 @@ public class TestOozieCLI extends DagSer
return path;
}
- private String createMRProperties(String appPath) throws Exception {
+ private String createMRProperties(String appPath, boolean useNewAPI)
throws Exception {
String path = getTestCaseDir() + "/" + getName() + ".properties";
Properties props = new Properties();
props.setProperty(OozieClient.USER_NAME, getTestUser());
@@ -133,8 +133,14 @@ public class TestOozieCLI extends DagSer
props.setProperty(OozieClient.RERUN_SKIP_NODES, "node");
props.setProperty(XOozieClient.NN, "localhost:9000");
props.setProperty(XOozieClient.JT, "localhost:9001");
- props.setProperty("mapred.mapper.class", "mapper.class");
- props.setProperty("mapred.reducer.class", "reducer.class");
+ if (useNewAPI) {
+ props.setProperty("mapreduce.map.class", "mapper.class");
+ props.setProperty("mapreduce.reduce.class", "reducer.class");
+ }
+ else {
+ props.setProperty("mapred.mapper.class", "mapper.class");
+ props.setProperty("mapred.reducer.class", "reducer.class");
+ }
props.setProperty("mapred.input.dir", "input");
props.setProperty("mapred.output.dir", "output");
props.setProperty("oozie.libpath", appPath);
@@ -234,7 +240,28 @@ public class TestOozieCLI extends DagSer
Path appPath = new Path(getFsTestCaseDir(), "app");
getFileSystem().mkdirs(appPath);
- String[] args = new String[]{"mapreduce", "-oozie", oozieUrl,
"-config", createMRProperties(appPath.toString())};
+ String[] args = new String[]{"mapreduce", "-oozie", oozieUrl,
"-config",
+ createMRProperties(appPath.toString(), false)};
+ assertEquals(0, new OozieCLI().run(args));
+ assertEquals("submitMR", MockDagEngineService.did);
+ assertTrue(MockDagEngineService.started.get(wfCount));
+ return null;
+ }
+ });
+ }
+
+ public void testSubmitMapReduce2() throws Exception {
+ runTest(END_POINTS, SERVLET_CLASSES, IS_SECURITY_ENABLED, new
Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ String oozieUrl = getContextURL();
+ int wfCount = MockDagEngineService.INIT_WF_COUNT;
+
+ Path appPath = new Path(getFsTestCaseDir(), "app");
+ getFileSystem().mkdirs(appPath);
+
+ String[] args = new String[]{"mapreduce", "-oozie", oozieUrl,
"-config",
+ createMRProperties(appPath.toString(), true)};
assertEquals(0, new OozieCLI().run(args));
assertEquals("submitMR", MockDagEngineService.did);
assertTrue(MockDagEngineService.started.get(wfCount));
Modified: oozie/trunk/release-log.txt
URL:
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1484974&r1=1484973&r2=1484974&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Tue May 21 21:35:43 2013
@@ -1,5 +1,6 @@
-- Oozie 4.1.0 release (trunk - unreleased)
+OOZIE-1387 Proxysubmission from the Oozie client doesn't allow the mapreduce
API (rkanter)
OOZIE-1244 SLA Support in Oozie (mona)
OOZIE-1371 oozie.coord.action.notification.url has no documentation (rkanter)
OOZIE-1328 Cover package org.apache.oozie.cli with unit tests (vbondarev via
virag)