* @return {@link ExecJob} containing information about this job
* @throws IOException
*/
public ExecJob store(String id, String filename, String func)
throws IOException {
PigStats stats = storeEx(id, filename, func);
if (stats.getOutputStats().size() < 1) {
throw new IOException("Couldn't retrieve job.");
}
OutputStats output = stats.getOutputStats().get(0);
if(stats.isSuccessful()){
return new HJob(JOB_STATUS.COMPLETED, pigContext, output
.getPOStore(), output.getAlias(), stats);
}else{
HJob job = new HJob(JOB_STATUS.FAILED, pigContext,
output.getPOStore(), output.getAlias(), stats);
//check for exception
Exception ex = null;
for(JobStats js : stats.getJobGraph()){
if(js.getException() != null)
ex = js.getException();
}
job.setException(ex);
return job;