Skip to content

Commit

Permalink
Closes OOZIE-118 fix pipes program accept relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelo Kaichen Huang authored and bansalmayank committed Jul 22, 2011
1 parent 2132585 commit 31586bb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public MapReduceActionExecutor() {
super("map-reduce");
}

@Override
protected List<Class> getLauncherClasses() {
List<Class> classes = super.getLauncherClasses();
classes.add(LauncherMain.class);
Expand All @@ -50,6 +51,7 @@ protected List<Class> getLauncherClasses() {
return classes;
}

@Override
protected String getLauncherMain(Configuration launcherConf, Element actionXml) {
String mainClass;
Namespace ns = actionXml.getNamespace();
Expand All @@ -74,6 +76,7 @@ Configuration setupLauncherConf(Configuration conf, Element actionXml, Path appP
return conf;
}

@Override
@SuppressWarnings("unchecked")
Configuration setupActionConf(Configuration actionConf, Context context, Element actionXml, Path appPath)
throws ActionExecutorException {
Expand Down Expand Up @@ -104,7 +107,7 @@ Configuration setupActionConf(Configuration actionConf, Context context, Element
String partitioner = pipesXml.getChildTextTrim("partitioner", ns);
String writer = pipesXml.getChildTextTrim("writer", ns);
String program = pipesXml.getChildTextTrim("program", ns);
PipesMain.setPipes(actionConf, map, reduce, inputFormat, partitioner, writer, program);
PipesMain.setPipes(actionConf, map, reduce, inputFormat, partitioner, writer, program, appPath);
}
}
actionConf = super.setupActionConf(actionConf, context, actionXml, appPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
import org.apache.hadoop.mapred.RunningJob;
import org.apache.hadoop.mapred.pipes.Submitter;
import org.apache.hadoop.filecache.DistributedCache;
import org.apache.hadoop.fs.Path;

public class PipesMain extends MapReduceMain {

public static void main(String[] args) throws Exception {
run(PipesMain.class, args);
}

@Override
protected RunningJob submitJob(Configuration actionConf) throws Exception {
JobConf jobConf = new JobConf();

Expand Down Expand Up @@ -72,7 +74,7 @@ protected RunningJob submitJob(Configuration actionConf) throws Exception {
}

public static void setPipes(Configuration conf, String map, String reduce, String inputFormat, String partitioner,
String writer, String program) {
String writer, String program, Path appPath) {
if (map != null) {
conf.set("oozie.pipes.map", map);
}
Expand All @@ -89,7 +91,13 @@ public static void setPipes(Configuration conf, String map, String reduce, Strin
conf.set("oozie.pipes.writer", writer);
}
if (program != null) {
Path path = null;
if (!program.startsWith("/")) {
path = new Path(appPath, program);
program = path.toString();
}
conf.set("oozie.pipes.program", program);

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void testSetupMethods() throws Exception {
assertEquals("IF", conf.get("oozie.pipes.inputformat"));
assertEquals("P", conf.get("oozie.pipes.partitioner"));
assertEquals("W", conf.get("oozie.pipes.writer"));
assertEquals("PP", conf.get("oozie.pipes.program"));
assertEquals(getFsTestCaseDir()+"/PP", conf.get("oozie.pipes.program"));
}

private Context createContext(String actionXml) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void testSetupMethods() throws Exception {
assertEquals("IF", conf.get("oozie.pipes.inputformat"));
assertEquals("P", conf.get("oozie.pipes.partitioner"));
assertEquals("W", conf.get("oozie.pipes.writer"));
assertEquals("PP", conf.get("oozie.pipes.program"));
assertEquals(getFsTestCaseDir()+"/PP", conf.get("oozie.pipes.program"));
}

protected Context createContext(String name, String actionXml) throws Exception {
Expand Down
1 change: 1 addition & 0 deletions release-log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ OOZIE-108 Upgrade pom version to 3.1.0.

-- Oozie 3.0.2 release

OOZIE-118 fix pipes program accept relative path
OOZIE-120 coordinator resolve config default variable
OOZIE-119 relative path in coord dataset include should throw exception if given
OOZIE-115 oozie should check if app path is directory and read the app xml under it
Expand Down

0 comments on commit 31586bb

Please sign in to comment.