|
Thanks Steve for finding the cause. That looks like a bug, it should not break anything.
Patch returning exit code from JobShell
My bad, an exception in main WILL return a non-zero exit code. But the reason why I've seen that the above patch was not sufficient was that ExamplesDriver catches uncaught exceptions from examples and returns silently. I think that needs to be fixed.
+1 for the fix. Examples can be fixed here or separately. Changed ExampleDriver also to return with non-zero exit code.
test-patch result:
[exec]
[exec] -1 overall.
[exec]
[exec] +1 @author. The patch does not contain any @author tags.
[exec]
[exec] -1 tests included. The patch doesn't appear to include any new or modified tests.
[exec] Please justify why no tests are needed for this patch.
[exec]
[exec] +1 javadoc. The javadoc tool did not generate any warning messages.
[exec]
[exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings.
[exec]
[exec] +1 findbugs. The patch does not introduce any new Findbugs warnings.
All core and contrib tests passed on my machine In ExampleDriver.java It isn't quite elegant to call System.exit from inside a catch clause, we should use an exit code:
int exitCode = -1;
...
try {
...
pgd.driver(argv);
exitCode = 0;
} catch(...) {
...
}
System.exit(exitCode);
Ideally, ProgramDriver.driver should have returned an exit code... sigh! We should also fix ProgramDriver.driver to throw an IllegalArgumentException when the sanity checks fail. I just committed this. Thanks to Amareshwari and Steve too!
-1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12393014/HADOOP-4340_2_20081029.patch against trunk revision 709022. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 Eclipse classpath. The patch retains Eclipse classpath integrity. -1 core tests. The patch failed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/3508/testReport/ This message is automatically generated. Integrated in Hadoop-trunk #647 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/647/
. Correctly set the exit code from JobShell.main so that the 'hadoop jar' command returns the right code to the user. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
JobShell.main() doesn't set an exit code
public static void main(String[] argv) throws Exception { JobShell jshell = new JobShell(); ToolRunner.run(jshell, argv); }
It should go System.exit(ToolRunner.run(...)))
question is, what is going to break?