Retrieves a list of Job objects from the PigStats object @param stats @return A list of ExecJob objects
(PigStats stats)
| 497 | * @return A list of ExecJob objects |
| 498 | */ |
| 499 | protected List<ExecJob> getJobs(PigStats stats) { |
| 500 | LinkedList<ExecJob> jobs = new LinkedList<ExecJob>(); |
| 501 | if (stats instanceof EmptyPigStats) { |
| 502 | HJob job = new HJob(HJob.JOB_STATUS.COMPLETED, pigContext, stats.result(null) |
| 503 | .getPOStore(), null); |
| 504 | jobs.add(job); |
| 505 | return jobs; |
| 506 | } |
| 507 | JobGraph jGraph = stats.getJobGraph(); |
| 508 | Iterator<JobStats> iter = jGraph.iterator(); |
| 509 | while (iter.hasNext()) { |
| 510 | JobStats js = iter.next(); |
| 511 | for (OutputStats output : js.getOutputs()) { |
| 512 | if (js.isSuccessful()) { |
| 513 | jobs.add(new HJob(HJob.JOB_STATUS.COMPLETED, pigContext, output |
| 514 | .getPOStore(), output.getAlias(), stats)); |
| 515 | } else { |
| 516 | HJob hjob = new HJob(HJob.JOB_STATUS.FAILED, pigContext, output |
| 517 | .getPOStore(), output.getAlias(), stats); |
| 518 | hjob.setException(js.getException()); |
| 519 | jobs.add(hjob); |
| 520 | } |
| 521 | } |
| 522 | } |
| 523 | return jobs; |
| 524 | } |
| 525 | |
| 526 | /** |
| 527 | * Discards a batch of Pig commands. |
no test coverage detected