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.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1485085 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4a4e42d919
commit
27e6673ec3
@ -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
|
||||
-->
|
||||
|
@ -117,7 +117,7 @@ public void addClass (String name, Class mainClass, String description) throws T
|
||||
* @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.
|
||||
@ -144,5 +144,14 @@ public int driver(String[] args)
|
||||
pgm.invoke(new_args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API compatible with Hadoop 1.x
|
||||
*/
|
||||
public void driver(String[] argv) throws Throwable {
|
||||
if (run(argv) == -1) {
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public CoreTestDriver(ProgramDriver pgd) {
|
||||
public void run(String argv[]) {
|
||||
int exitCode = -1;
|
||||
try {
|
||||
exitCode = pgd.driver(argv);
|
||||
exitCode = pgd.run(argv);
|
||||
} catch(Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public HdfsTestDriver(ProgramDriver pgd) {
|
||||
public void run(String argv[]) {
|
||||
int exitCode = -1;
|
||||
try {
|
||||
exitCode = pgd.driver(argv);
|
||||
exitCode = pgd.run(argv);
|
||||
} catch(Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -179,6 +179,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
|
||||
|
@ -112,7 +112,7 @@ public MapredTestDriver(ProgramDriver pgd) {
|
||||
public void run(String argv[]) {
|
||||
int exitCode = -1;
|
||||
try {
|
||||
exitCode = pgd.driver(argv);
|
||||
exitCode = pgd.run(argv);
|
||||
} catch(Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public static void main(String argv[]){
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user