MAPREDUCE-5156. Change hadoop examples ProgramDriver to be able to run 1.x examples jar on top of YARN. This change breaks 0.23.x direct usages of ProgramDriver. Contributed by Zhijie Shen.

svn merge --ignore-ancestry -c 1485085 ../../trunk/


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1485086 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-05-22 06:37:01 +00:00
parent c28a0860e2
commit f71593ae2c
7 changed files with 24 additions and 6 deletions

View File

@ -100,6 +100,11 @@
<Method name="run" />
<Bug pattern="DM_EXIT" />
</Match>
<Match>
<Class name="org.apache.hadoop.util.ProgramDriver" />
<Method name="driver" />
<Bug pattern="DM_EXIT" />
</Match>
<!--
We need to cast objects between old and new api objects
-->

View File

@ -117,7 +117,7 @@ public class ProgramDriver {
* @throws IllegalArgumentException
* @throws Throwable Anything thrown by the example program's main
*/
public int driver(String[] args)
public int run(String[] args)
throws Throwable
{
// Make sure they gave us a program name.
@ -145,4 +145,13 @@ public class ProgramDriver {
return 0;
}
/**
* API compatible with Hadoop 1.x
*/
public void driver(String[] argv) throws Throwable {
if (run(argv) == -1) {
System.exit(-1);
}
}
}

View File

@ -52,7 +52,7 @@ public class CoreTestDriver {
public void run(String argv[]) {
int exitCode = -1;
try {
exitCode = pgd.driver(argv);
exitCode = pgd.run(argv);
} catch(Throwable e) {
e.printStackTrace();
}

View File

@ -47,7 +47,7 @@ public class HdfsTestDriver {
public void run(String argv[]) {
int exitCode = -1;
try {
exitCode = pgd.driver(argv);
exitCode = pgd.run(argv);
} catch(Throwable e) {
e.printStackTrace();
}

View File

@ -11,6 +11,10 @@ Release 2.0.5-beta - UNRELEASED
compatibility with mapred in 1.x but incompatible with 0.23.x. (Mayank Bansal
via vinodkv)
MAPREDUCE-5156. Change hadoop examples ProgramDriver to be able to run
1.x examples jar on top of YARN. This change breaks 0.23.x direct usages of
ProgramDriver. (Zhijie Shen via vinodkv)
NEW FEATURES
IMPROVEMENTS

View File

@ -112,7 +112,7 @@ public class MapredTestDriver {
public void run(String argv[]) {
int exitCode = -1;
try {
exitCode = pgd.driver(argv);
exitCode = pgd.run(argv);
} catch(Throwable e) {
e.printStackTrace();
}

View File

@ -71,7 +71,7 @@ public class ExampleDriver {
pgd.addClass("teragen", TeraGen.class, "Generate data for the terasort");
pgd.addClass("terasort", TeraSort.class, "Run the terasort");
pgd.addClass("teravalidate", TeraValidate.class, "Checking results of terasort");
exitCode = pgd.driver(argv);
exitCode = pgd.run(argv);
}
catch(Throwable e){
e.printStackTrace();