Permalink
Browse files

Add final report access to the client service and have KittenClient c…

…heck for it by default
  • Loading branch information...
1 parent 1487057 commit da1d15123a6bab4ea10670e4b9d8409ae0ab50f4 @jwills jwills committed Jul 2, 2012
@@ -23,6 +23,7 @@
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import com.cloudera.kitten.client.params.lua.LuaYarnClientParameters;
@@ -92,12 +93,15 @@ public int handle(YarnClientService service) throws Exception {
}
}
- service.stopAndWait();
- System.exit(0);
- return 0;
+ if (service.getFinalReport().getFinalApplicationStatus() == FinalApplicationStatus.SUCCEEDED) {
+ return 0;
+ } else {
+ return 1;
+ }
}
public static void main(String[] args) throws Exception {
- ToolRunner.run(new Configuration(), new KittenClient(), args);
+ int rc = ToolRunner.run(new Configuration(), new KittenClient(), args);
+ System.exit(rc);
}
}
@@ -47,4 +47,9 @@
* cluster.
*/
boolean isApplicationFinished();
+
+ /**
+ * Returns the final application report for this job.
+ */
+ ApplicationReport getFinalReport();
}
@@ -179,6 +179,11 @@ public boolean isApplicationFinished() {
}
@Override
+ public ApplicationReport getFinalReport() {
+ return finalReport;
+ }
+
+ @Override
public ApplicationReport getApplicationReport() {
GetApplicationReportRequest reportRequest = Records.newRecord(GetApplicationReportRequest.class);
reportRequest.setApplicationId(applicationId);
@@ -16,7 +16,7 @@ distshell = yarn {
env = base_env,
command = {
base = "java -Xmx128m com.cloudera.kitten.appmaster.ApplicationMaster",
- args = { "-conf job.xml" }, -- job.xml contains the client configuration info.
+ args = { "-conf job.xml", "1> <LOG_DIR>/stdout 2> <LOG_DIR>/stderr" }, -- job.xml contains the client configuration info.
}
},

0 comments on commit da1d151

Please sign in to comment.